-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request timed out error while using Google provider #3920
Comments
Is there any fix for this?
The same code works fine in production but in localhost this error is coming. |
I just redeployed the local code to another domain using vercel, and it works in production, the bug is only for localhost I think. |
Facing same issue only for localhost |
facing the same issue on localhost randomly. |
No bug in sight, your Node.js process may not be able to reach google servers for a variety of local network / network setup related reasons. |
I am facing the same issue for the past 24 hours only, the same code worked fine earlier, and I have never encountered this issue before. |
openid-client is not the source of your issue then |
Hi, facing the same issue only on localhost. If any solution please write here. |
It seems there is some issue with the auth server, because when I increase the timeout to 40 secs from openid-client it times out again with an error |
Is this still happening for everyone? It is happening for me, not only with google auth but also with github auth. Was anyone able to find a fix? |
It is working fine for me now. |
Oh, on production or dev? Also, which provider are you using and did you have to set anything else up? (other than |
This issue was only happening with google provider, and not with other providers. If you are having a problem with all the providers it's more of a config /app issue from your side. |
Oh, it is happening with GitHub for me as well. I have set all the fields as well - export default NextAuth({
adapter: CustomMongooseAdapter(),
providers: [
GoogleProvider({
clientId: process.env.GOOGLE_CLIENT_ID,
clientSecret: process.env.GOOGLE_CLIENT_SECRET,
}),
GitHubProvider({
clientId: process.env.GITHUB_CLIENT_ID,
clientSecret: process.env.GITHUB_CLIENT_SECRET,
}),
],
callbacks: {
async session({ session, token, user }) {
// Store the user's profile in the session
session.user = user;
return session;
},
},
}); Don't know if I am going wrong anywhere. Also this problem started occuring out of nowhere. Don't know why. |
It's not working with Github as well. |
Can you guys try passing httpOptions with timeout like shown below (40000 is in ms)and check the error, now it won't timeout because of openid-client, but you'll see some error due to network issue with google/github auth server from there you can further check the issue.
|
Problem solved for me without changing anything. |
It works for Google provider, but not GitHubs. |
I had this issue on wsl when I switched to windows, it worked as expected. maybe some kind of network issue with wsl? |
How is this closed? oO |
I'm facing the same issue with the Google Provider too. Increasing the timeout doesn't seem to do any good. |
FYI: It worked for me when using Chrome with |
Same issue, cropped up randomly after working for days in dev (localhost). Works fine when deployed in prod. No changes were made whatsoever to the Nextauth config. Lengthened http timeout to 40s, same error. |
Soo did you fix it???? |
Hi, currently using WSL and facing this issue. Tried the timeout 40s as suggested but it doesn't seem to work. How did you fix yours? I was thinking it's an issue with the version of node i'm using. |
I faced this issue a couple times with different providers and I get it to work by turning on/off my wifi connection in my laptop. |
this happened with me while i was on "A" wifi. |
So is this problem solved? 🤨 |
I solve my issue by upgrading node v18.x.x to node v20.x.x |
This is obviously a network issue, so why is it relevant to node? |
Because of the changes that Node v20x. It handles http services differently, I just could not find the details now. |
What really made it work for me with all node versions (16.x, 18.x, 20.x) is: In your /etc/resolv.conf ensure you have In your /etc/wsl.conf ensure you have Then I ran this: |
GoogleProvider({
httpOptions: {
agent // Maybe we can solve it here?
}
}) |
ye this work, by changing the DNS server for wsl issue can be solved. but the issue can also be solved by changing the DNS in the windows setting then you don't have to change anything in wsl.conf because by default wsl use window host dns settings |
Hi, facing the same issue. Is there any solution for this? |
There seems to be no decent solution. |
That sucks! How is this closed? |
I resolved timeout issues by adding this to my code:
As it turns out, it was a dns issue |
@balazsorban44 Actually this problem is not very well solved, why close it ? 🤨,Perhaps this question is more appropriate to move on to the discussion and get a standard answer to this question. |
I'm on Windows and use a Cloudflare tunnel to test sign-in flow and I got the same issue. |
This works for me. |
This works for me |
export default NextAuth({
], |
|
I have the exact same problem with AzureADProvider, which doesn't even seem to have a timeout setting. Was using node 18, but problem also occurs in 20 and 22 |
L bug |
same problem, not solved in year 2025!? |
Description 🐜
After following the docs for Prisma Adapter and Google Provider, I added auth to my repo, but when trying to log in through google auth, it's timing out for some reason.
I even tried with a longer timeout, but still no luck :(
Is this a bug in your own project?
Yes
How to reproduce ☕️
I replicated the issue in a new separate repo, just add the env variable and run it in local - https://github.com/Nikit-Singh/next-auth-google-issue
Screenshots / Logs 📽
No response
Environment 🖥
System:
OS: Windows 10 10.0.22000
CPU: (16) x64 AMD Ryzen 7 3700X 8-Core Processor
Memory: 4.38 GB / 15.95 GB
Binaries:
Node: 16.13.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.17 - ~\AppData\Roaming\npm\yarn.CMD
npm: 8.3.1 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Spartan (44.22000.120.0), Chromium (96.0.1054.62)
Internet Explorer: 11.0.22000.120
npmPackages:
next: 12.0.10 => 12.0.10
next-auth: ^4.2.1 => 4.2.1
react: 17.0.2 => 17.0.2
Contributing 🙌🏽
Yes, I am willing to help solve this bug in a PR
The text was updated successfully, but these errors were encountered: