Auth0 SDK not working with other serverless functions using NextJS and Vercel
See original GitHub issueDescribe the problem
When using the NextJS Auth0 SDK you get a 404 not found error instead of getting redirected to the login page. Callback and logout URL are correctly specified to http://localhost:3000
and http://localhost:3000/api/callback
What was the expected behavior?
A redirect to the login page and the other serverless functions still working.
Reproduction
- Use NextJS together with Vercel to handle serverless functions.
- Create serverless functions in a different language than JS. In my case this would be go. These serverless functions are located outside the pages/api/auth folder (they are in the root api folder)
- Try to access the login/logout/… API routes
Environment
- Version of this library used: 1.3.1
- Which framework are you using, if applicable: NextJS
- Other modules/plugins/libraries that might be involved: GoLang serverless functions
- Any other relevant information you think would be useful: The website is started by using
vercel dev
. I am also using Go serverless functions.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
NextJS SDK results in page not found - Auth0 Community
I have used the example code from the NextJS quick start guide. Another probably important detail would be that I also use Go...
Read more >The Ultimate Guide to Next.js Authentication with Auth0
Learn how and where to authenticate your user in the different deployment models that exist for Next.js. This guide explores the Custom ...
Read more >Auth0 with next-auth running locally, but not on Vercel
Hello, I am developing an admin area for a website, using NextJS 10, ... Vercel's serverless function logs show hits onto /admin and ......
Read more >How to leverage SSO in nextjs-auth0?
I can't seem to get SSO easily set up and connected with the NextJS migration we're planning to have. The goal is that...
Read more >[SOLVED] NextJS Vercel deployment issue. 500 server ...
I'm posting here in case it helps others in future. Whilst digging in github issues I came across this thread Auth0 login fails...
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
@PumPum7 - doesn’t sound like this is an problem with the SDK and you have resolved your issue, so closing.
Feel free to ping me if you’d like me to reopen it
Hey @PumPum7, can you please share more details on how you managed to get it to work ?
For example, what version of next did you use ? Or anything else you may find relevant.
I tried moving the pages/api/auth[…auth0].js file to <root>/api/auth/ but that did not help me. Same 404 error.
Cheers!