NEXTAUTH_URL has been set but it still shows [next-auth][error][CLIENT_FETCH_ERROR]
See original GitHub issueDescription 🐜
The Next auth is working fine on local and on vercel it throws [next-auth][error][CLIENT_FETCH_ERROR]
Although I have set JWT and NEXTAUTH_URL in my vercel env creds
https://google-places-unravel.vercel.app/
Is this a bug in your own project?
Yes
How to reproduce ☕️
import NextAuth from "next-auth";
import GithubProvider from "next-auth/providers/github";
import GoogleProvider from "next-auth/providers/google";
import { getToken } from "next-auth/jwt"
export default NextAuth({
// Configure one or more authentication providers
providers: [
GoogleProvider({
clientId: process.env.GOOGLE_CLIENT_ID,
clientSecret: process.env.GOOGLE_CLIENT_SECRET,
}),
// ...add more providers here
],
jwt: {
// A secret to use for key generation. Defaults to the top-level `secret`.
secret: process.env.JWT_SECRET,
// The maximum age of the NextAuth.js issued JWT in seconds.
// Defaults to `session.maxAge`.
maxAge: 60 * 60 * 24 * 30,
// You can define your own encode/decode functions for signing and encryption
// if you want to override the default behavior.
async encode({ secret, token, maxAge }) {},
async decode({ secret, token }) {},
}
});
Screenshots / Logs 📽
Environment 🖥
Vercel.com
Contributing 🙌🏽
Yes, I am willing to help solve this bug in a PR
Issue Analytics
- State:
- Created 2 years ago
- Reactions:5
- Comments:10 (1 by maintainers)
Top Results From Across the Web
Errors - NextAuth.js
This error occurs when the SessionProvider Context has a problem fetching session data. CLIENT_FETCH_ERROR. If you see CLIENT_FETCH_ERROR make ...
Read more >How to solve client fetch error for next-auth authentication
I created an .env.local file and stored my live site url. Yet on the live site I am still getting a server error...
Read more >next auth client fetch error | The AI Search Engine You Control
1 Answer. If you see CLIENT_FETCH_ERROR make sure you have configured the NEXTAUTH_URL environment variable. when developing you set it to localhost:3000, now ......
Read more >How to set up the next-auth library for development ... - Medium
When we do not pass or forget the NEXTAUTH_URL environment variable in nextjs. Then we face a NEXTAUTH_URL warning or error in next-auth....
Read more >How to solve client fetch error for next-auth authentication ...
If you see CLIENT_FETCH_ERROR make sure you have configured the NEXTAUTH_URL environment variable. when developing you set it to localhost:3000, now you ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello, I’m facing the same issue.
.env file
dependencies
_app.tsx
logs
Okay solution for this is to add secret: process.env.SECRET above jwt and it’ll work on PROD