Open osequi opened 2 years ago
Note when adding the https://example.com/custom-route/api/auth
url from https://next-auth.js.org/configuration/options#nextauth_url I'm getting the same error:
Hi @osequi , I've proposed a workaround here : https://github.com/nextauthjs/next-auth/issues/4748 Hopping it could help you,
It seems NEXTAUTH_URL can be only set in .env files: https://github.com/nextauthjs/next-auth/issues/1505#issuecomment-797660838
This should only be set in environment variables, but when does next.config.js runs to overwrite it?
I took my inspiration from this post to manage my variables setting in next.config.js You are reading environment variables the wrong way in Next.js . This make the lint, build and run to fail if an env variable is missing.
Environment
Reproduction URL
na
Describe the issue
I have
and
When running the app I'm getting:
How to reproduce
In a plain simple NextAuth app add these two files
env.development.local
andnext.config.js
with the content from the above examples.Expected behavior
The NEXTAUTH_URL should be
http://example.com/overwritten-in-nextconfig/
vs.http://localhost:3000/overwritten-in-nextconfig/