Hosting via Vercel not working because of AUTH0_BASE_URL.
See original GitHub issueDescription
Hi, I would like to reopen https://github.com/auth0/nextjs-auth0/issues/383, as https://github.com/auth0/nextjs-auth0/pull/404 did not fix the problem, as you can see in the last comments of https://github.com/auth0/nextjs-auth0/issues/383.
The documentation at https://github.com/auth0/nextjs-auth0/blob/main/examples/README.md#assigning-the-auth0_base_url seems wrong to me, as the env
key in config and the webpack DefinePlugin
don’t work for files in node_module, which are not touched by webpack.
Moreover, on a Vercel side, the VERCEL_URL reference the “by commit domain”, and not the “by PR domain”, so we can’t use auth0 with the standard PR domain.
We have to figure out another way to do this.
Any thoughts about this?
Thanks.
Environment
- Version of this library used: v1.4.0
- Version of the platform or framework used, if applicable: Next 10.2.3 with Vercel
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:31 (10 by maintainers)
Top Results From Across the Web
Auth0 works on localhost but not on vercel
everything works on localhost smoothly, then deployed to vercel. the credential login works well, but the Auth0 give error like this. Please ...
Read more >[SOLVED] NextJS Vercel deployment issue. 500 server ...
When working locally everything works as expected but when attempting to login on the vercel site auth0 returns a 500.
Read more >Next.js Vercel access_denied (unauthorized)
Answer: access_denied happens when Auth0 can't issue a token (Auth0 refuses the authorization). It can happen for many reasons, and the ...
Read more >How to redirect to generated staging links (with Vercel)?
In my auth0 application settings I tried setting Allowed Callback URLs/CORS/origins to the following, but it doesnt seem to work.
Read more >The Ultimate Guide to Next.js Authentication with Auth0
Static hosting sites (like Vercel, Amazon S3, Azure Blob Storage, ... The base url of your application AUTH0_BASE_URL=http://localhost:3000 ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I can confirm that committing a
.env.production
with the following works.Also, specifying
AUTH0_BASE_URL
for your production domain in the Vercel environment config (through GUI or CLI) will properly override what’s defined in the.env.production
file.@sioquim - I’ve been testing this and assiging
AUTH0_BASE_URL
for the build command (AUTH0_BASE_URL="$VERCEL_URL" npm build
) doesn’t work because it only provides theAUTH0_BASE_URL
during the Build Step not during Serverless Function execution when it’s required by the SDK. Am I missing something?