# Nextjs Auth0 Discovery Timeout Error

**URL:** <https://community.auth0.com/t/nextjs-auth0-discovery-timeout-error/96667>\
**Category:** Get Help\
**Tags:** apis, application\
**Created:** [December 17, 2022, 4:24pm UTC](https://community.auth0.com/t/nextjs-auth0-discovery-timeout-error/96667 "2022-12-17T16:24:19Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![nathanhealea](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nathanhealea/32/42022_2.png) [@nathanhealea](https://community.auth0.com/u/nathanhealea)\
**Post date:** [December 17, 2022, 4:24pm UTC](https://community.auth0.com/t/nextjs-auth0-discovery-timeout-error/96667/1 "2022-12-17T16:24:19Z")

</div>

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 [https://llamapass-dev.us.auth0.com](https://llamapass-dev.us.auth0.com), 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?

---

<div class="post-metadata">

**Author:** ![kimia.salamo9881](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/kimia.salamo9881/32/36235_2.png) [@kimia.salamo9881](https://community.auth0.com/u/kimia.salamo9881)\
**Post date:** [December 19, 2022, 6:49am UTC](https://community.auth0.com/t/nextjs-auth0-discovery-timeout-error/96667/2 "2022-12-19T06:49:25Z")

</div>

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[.](https://www.onecognizant.net/)

---

<div class="post-metadata">

**Author:** ![nightfury](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nightfury/32/42350_2.png) [@nightfury](https://community.auth0.com/u/nightfury)\
**Post date:** [January 6, 2023, 11:17am UTC](https://community.auth0.com/t/nextjs-auth0-discovery-timeout-error/96667/3 "2023-01-06T11:17:15Z")

</div>

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`:

```auto
const dns = require("dns");
dns.setDefaultResultOrder("ipv4first");

```

[https://nodejs.org/api/dns.html#dnssetdefaultresultorderorder](https://nodejs.org/api/dns.html#dnssetdefaultresultorderorder)

This forces nodejs to favor ipv4 over ipv6.

Some more details:

`nslookup <mydomain>.us.auth0.com` returns the following

```auto
Address: 104.16.170.253
Address: 104.16.171.253
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.

---

<div class="post-metadata">

**Author:** ![mayhem](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mayhem/32/15743_2.png) [@mayhem](https://community.auth0.com/u/mayhem)\
**Post date:** [February 16, 2023, 10:17pm UTC](https://community.auth0.com/t/nextjs-auth0-discovery-timeout-error/96667/4 "2023-02-16T22:17:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mayhem](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mayhem/32/15743_2.png) [@mayhem](https://community.auth0.com/u/mayhem)\
**Post date:** [February 16, 2023, 11:11pm UTC](https://community.auth0.com/t/nextjs-auth0-discovery-timeout-error/96667/5 "2023-02-16T23:11:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [February 17, 2023, 7:54am UTC](https://community.auth0.com/t/nextjs-auth0-discovery-timeout-error/96667/6 "2023-02-17T07:54:58Z")

</div>

Thanks for sharing it with the rest of community!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [March 3, 2023, 7:55am UTC](https://community.auth0.com/t/nextjs-auth0-discovery-timeout-error/96667/7 "2023-03-03T07:55:19Z")

</div>

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