Nextjs Auth0 Discovery Timeout Error

Hi Community,

I currently working on a NextJS Auth0 proof of concept. I’ve been having been making a lot of progress thus far, however, I have stated to get an error that I cannot find any reference to. I’m current using the @auth0/nextjs-auth0 npm package.

Login handler failed. CAUSE: Discovery requests failing for, outgoing request timed out after 5000ms

This started happening after a few days of testing my application and working through a couple of tutorials and testing.

Any ideas as to what is causing this error and how to resolve it?

After a 5-6 month I just started the and I am also having a same issue. If anyone have any idea about that then tell and help us.

I had exactly the same problem. After I went through the nextjs tutorial everything worked fine. And then I encountered the same error (I can not tell if I have something installed on my system).

On my machine (Fedora 37) it was an ipv6 problem. As a workaround I use the following line in next.config.js:

const dns = require("dns");

This forces nodejs to favor ipv4 over ipv6.

Some more details:

nslookup <mydomain> returns the following

Address: 2606:4700::6810:aafd
Address: 2606:4700::6810:abfd

While a GET request to the discover URL (https://<mydomain>/.well-known/openid-configuration) over ipV4 worked (returned a 403 but that was expected). The same request over ipv6 encountered a timeout.

Maybe I will open an issue on github, but not exactly sure if this is the right place.

Maybe I will open an issue on github, but not exactly sure if this is the right place.

The dns workaround did not work for me. Has anyone else come up with a solution to this problem?

turns out my issue was a bad copy paste job of key values in my vercel env settings

1 Like

Thanks for sharing it with the rest of community!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.