Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs for "Hosting on Vercel > Preview Deployments" no longer work #1206

Closed
6 tasks done
mattrossman opened this issue May 11, 2023 · 2 comments · Fixed by #1210
Closed
6 tasks done

Docs for "Hosting on Vercel > Preview Deployments" no longer work #1206

mattrossman opened this issue May 11, 2023 · 2 comments · Fixed by #1210
Labels
question Further information is requested

Comments

@mattrossman
Copy link

Checklist

Description

The docs say that for Vercel Preview deployments you should set:

# .env.production
NEXT_PUBLIC_AUTH0_BASE_URL=$VERCEL_URL

(source)

When I do this, I get a 500 error saying that baseURL is required. Even though I can see that NEXT_PUBLIC_AUTH0_BASE_URL is correctly set in my logs, the library seems to not recognize it.

Additionally, the docs suggest that you can use $VERCEL_BRANCH_URL for branch preview URLs, however this variable is undefined and I can't find it mentioned in the Vercel System Environment Variables (perhaps deprecated?)

Reproduction

  1. Clone sample app https://github.com/auth0-samples/auth0-nextjs-samples/tree/main/Sample-01
  2. Assign "Preview" environment variables on Vercel, with exception of AUTH0_BASE_URL
  3. Add .env.production file as shown above
  4. Configure Auth0 to allow *.vercel.app callback URLs / logout URLs
  5. npx vercel deploy and follow prompts
  6. Open preview URL and attempt login

Additional context

If I change the .env.production file to set AUTH0_BASE_URL instead of NEXT_PUBLIC_AUTH0_BASE_URL then I can log in as expected (only on "commit" style preview URLs, not the branch preview URLs)

I'm not sure why this happens because this library appears to check both variables:

const AUTH0_BASE_URL = process.env.AUTH0_BASE_URL || process.env.NEXT_PUBLIC_AUTH0_BASE_URL;

Perhaps the environment variables behavior has changed in recent Next.js versions.

nextjs-auth0 version

2.5.0

Next.js version

13.4.1

Node.js version

18.16.0

@mattrossman
Copy link
Author

Looks like this PR was very recent so maybe these docs are just ahead of the latest release? #1198

@adamjmcgrath
Copy link
Contributor

Hi @mattrossman - thanks for raising this

Yep, I'll do a release of 2.6 today to catch up with those docs changes

@adamjmcgrath adamjmcgrath added the question Further information is requested label May 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants