#NEXTAUTH_URL - should be known while building?
12 messages · Page 1 of 1 (latest)
🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord
🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize
✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)
Hi @gentle fox
Sure.
I have an app that uses next-auth.
When I run npm run build it fails at the info - Collecting page data... stage saying something like:
TypeError [ERR_INVALID_URL]: Invalid URL
at new NodeError (node:internal/errors:405:5)
at new URL (node:internal/url:778:13)
at parseUrl (/builds/<project>/node_modules/next-auth/utils/parse-url.js:17:16)
...
I was able to empirically track down what URL it's talking about. It's NEXTAUTH_URL
I want to have it undefined/empty while building, because it's different for prod/dev/stage
iirc, nextauth requires NEXTAUTH_URL in env or you should put fallback url somewhere else
Environment Variables
Here they say: When deploying to production, set the NEXTAUTH_URL environment variable to the canonical URL of your site.
Deploying, not building. If it matters...