I am trying to use NextAuth on preview version of my site, but I keep getting this error in the console [next-auth][error][CLIENT_FETCH_ERROR] and when i try to visit the login page, i get the error in the image below. According to this doc, the NEXTAUTH_URL should have been set automatically and looking at the logs this seems to be the case since I can see this in the logs 2:04:00 AM: 2:04:00 AM: NextAuth package detected, setting NEXTAUTH_URL environment variable to https://deploy-preview-21--weedle.netlify.app 2:04:00 AM: { functionsDir: '/opt/build/repo/.netlify/functions-internal' }. Can’t quite figure out why i’m still getting this error.
Hi @SamO … thanks for the response… I tried clearing cache and even incognito, didn’t work.
Here is what I have tried.
Since according to the netlify docs, the url will be automatically set, I initially didn’t set an environment vars. Looking at the logs I noticed its being set already (Image included below).
Since I don’t know the preview url before hand, I followed the instructions here to use the netlify.toml file in setting it. Here is what the netlify.toml looks like