Works locally but not in production :( #7096
Replies: 5 comments 3 replies
-
same issue here |
Beta Was this translation helpful? Give feedback.
-
Having same issue with latest next-auth, prisma adapter, github provider, and vercel hosting. Frankly, getting it to work locally took some schema upgrading. |
Beta Was this translation helpful? Give feedback.
-
@depyronick @e-simpson In my case, the problem was solved.
In my case, it was caused by Firebase hosting (even if we add a custom domain, the Firebase and cloud run service itself generates other domains for the same site). It didn't matter that the callbackURL and the page I was on overlapped (sometimes a request from one of the backup addresses was running in the background without my knowledge) Changing the firebase hosting -> cloud run redirection to a dedicated global load balancer with cloud run as the backend and switching cloud run to "allow only internal connection + load balancer" solved the problem (I know that you can add domain mapping in cloud run itself, but it works it's only in selected regions + I wanted to have some additional services for this, e.g. cloud armor) I hope I helped :) |
Beta Was this translation helpful? Give feedback.
-
@michal-dobrzykowski thanks for the update. |
Beta Was this translation helpful? Give feedback.
-
We encounter this issue almost every day. I’ve personally experienced this error as well, and I am certain that the cookie has not expired. We are using nextjs (14.2.4), next-atuh(4.24.7) to integrated with Azure AD B2C. |
Beta Was this translation helpful? Give feedback.
-
Question 💬
Hi, I have a problem with next-auth 4.20.1 (in 4.19.2 it also occurs).
Site works on localhost but not on production
In logs I only have this even after setting debug: true (in addition, it is displayed as level info):
On production, I can normally go through the google login flow and cookies are set:
but i'm not logged in and i'm redirected to:
https://[my site]?callbackUrl=https://[my site]?error=OAuthCallback
My setup looks like this:
1. Environment variables:
2. OAuth client:
3. pages\api\auth[...nextauth].ts
4. Prisma migration was done and cloud run can run with database
On GCP it works based on Cloud Run, Serverless VPC Access, Cloud SQL. The services communicate using the internal ip and have the appropriate permissions set. Cloud run is connected to firebase hosting (additional cache headers turned off for testing, i.e. set to "no-store, max-age=0")
I'm running out of ideas what might not work there.
Does anyone know what's wrong with this?
Thanks in advance for your help
Contributing 🙌🏽
Yes, I am willing to help answer this question in a PR
Beta Was this translation helpful? Give feedback.
All reactions