Reputation: 41
The problem:
My next-auth works locally, but when I deploy it to google App Engine I get this [next-auth][error][CLIENT_FETCH_ERROR] invalid json response body at https://accounts.google.com/InteractiveLogin...
Works fine in dev mode but not in production... I've seen a lot of forums talking about NEXTAUTH_URL but it is set correctly.
See the error log here
Any idea about where the issue could come from?
What I have already checked locally and on GAE:
[...nextauth].ts is correctly placed in /pages/api/auth folder
it is correctly named exactly as I have written above
NEXTAUTH_URL is correctly set (not using any custom basePath)
NEXTAUTH_SECRET is correctly set
Google provider env vars are set correctly
Upvotes: 2
Views: 2806
Reputation: 41
Well, I ended up fixing it.
Turns out, the application is running on localhost:8080
inside App_Engine so putting my NEXTAUTH_URL
as my domain wouldn't work.
Fortunately, Next auth taught this through and I simply added NEXTAUTH_URL_INTERNAL=http://localhost:8080
as a new env variable and now it works like a charm!
Upvotes: 2