[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!

Hey team!

This topic seems related to the new Auth0 Integration available new in Vercel Marketplace. This is the first version of this integration, and we welcome your feedback to improve future iterations.

You’ll need an existing Vercel project to use the new integration to build and customize the Identity flow. You can either import your project into Vercel or use a Vercel template so you don’t have to start from scratch like our SaaStart template to deploy a production-ready B2B SaaS app in minutes (learn more here).

If you find yourself having questions regarding this new integration for the next two weeks, we are hosting an Ask Me Anything session. Our Product Expert will provide comprehensive written answers on August 8th from 8 AM to 10 AM PST.

Find out more about Auth0 Integration and learn more about AMA.

Thanks!
Dawid