question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Auth0 SDK not working with other serverless functions using NextJS and Vercel

See original GitHub issue

Describe 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

  1. Use NextJS together with Vercel to handle serverless functions.
  2. 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)
  3. 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:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
adamjmcgrathcommented, May 26, 2021

@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

0reactions
dlcaiocommented, Jul 22, 2022

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!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found