[SOLVED] NextJS Vercel deployment issue. 500 server response for universal login

Hi, I have worked off the @auth0/nextjs example on github and linked my github with vercel. As a result vercel have deployed a dummy site for me to preview my web app. When working locally everything works as expected but when attempting to login on the vercel site auth0 returns a 500.
I have added the above link as allowed URLs to my application auth0. Is there anything else I need to do? I have also marked my application for production. Is there an extra deploy step?

Upon further inspection I can see in the logs coming from vercel that there is this error:
TypeError: “secret” is required
When making a get request to all /api/auth/* endpoints. Do I need to create another .env file? I only have .env.local with all my credentials in there.

Any advise is appreciated.

I’m posting here in case it helps others in future. Whilst digging in github issues I came across this thread Auth0 login fails with '"secret" is required' when deployed to Netlify · Issue #393 · auth0/nextjs-auth0 · GitHub.
Long story short, it’s possible to add all your environment variables manually to vercel, I’m sure this was part of the fix but it didn’t actually work for me until I created a .env.production for vercel to consume. Which is mentioned at the bottom of this README nextjs-auth0/README.md at main · auth0/nextjs-auth0 · GitHub.

Good luck!

2 Likes

Thanks for sharing that with the rest of community!