-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
warn for incompat nextauth url and port
- Loading branch information
1 parent
e71bedd
commit b4c0356
Showing
11 changed files
with
79 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"create-t3-app": minor | ||
--- | ||
|
||
feat: add a warning if nextuath url doens't match the port in dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
21 changes: 21 additions & 0 deletions
21
cli/template/extras/config/next-config/with-auth-appdir.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** | ||
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially useful | ||
* for Docker builds. | ||
*/ | ||
import { env } from "./src/env.mjs"; | ||
|
||
// Warn if local development URL doesn't match with the active port | ||
const nextAuthPort = new URL(env.NEXTAUTH_URL).port; | ||
if (env.NODE_ENV === "development" && nextAuthPort !== String(env.PORT)) { | ||
throw new Error( | ||
[ | ||
`❗ NEXTAUTH_URL (${env.NEXTAUTH_URL}) doesn't match with PORT (${env.PORT}).`, | ||
`Either update your the URL in your .env file or make sure to run your dev server on port ${nextAuthPort}.`, | ||
].join(" "), | ||
); | ||
} | ||
|
||
/** @type {import("next").NextConfig} */ | ||
const config = {}; | ||
|
||
export default config; |
33 changes: 33 additions & 0 deletions
33
cli/template/extras/config/next-config/with-auth-pagedir.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially useful | ||
* for Docker builds. | ||
*/ | ||
import { env } from "./src/env.mjs"; | ||
|
||
// Warn if local development URL doesn't match with the active port | ||
const nextAuthPort = new URL(env.NEXTAUTH_URL).port; | ||
if (env.NODE_ENV === "development" && nextAuthPort !== String(env.PORT)) { | ||
throw new Error( | ||
[ | ||
`❗ NEXTAUTH_URL (${env.NEXTAUTH_URL}) doesn't match with PORT (${env.PORT}).`, | ||
`Either update your the URL in your .env file or make sure to run your dev server on port ${nextAuthPort}.`, | ||
].join(" "), | ||
); | ||
} | ||
|
||
/** @type {import("next").NextConfig} */ | ||
const config = { | ||
reactStrictMode: true, | ||
|
||
/** | ||
* If you are using `appDir` then you must comment the below `i18n` config out. | ||
* | ||
* @see https://github.com/vercel/next.js/issues/41980 | ||
*/ | ||
i18n: { | ||
locales: ["en"], | ||
defaultLocale: "en", | ||
}, | ||
}; | ||
|
||
export default config; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters