0

I am making a Next.js app with Next-auth.js authentication. The app is deployed on vercel. When I tried to open my app, it shows error in console. Here is the list of errors:

  • Failed to load resource: the server responded with a status of 500 ()
  • [next-auth][error][CLIENT_FETCH_ERROR] https://next-auth.js.org/errors#client_fetch_error There is a problem with the server configuration. Check the server logs for more information.
  • /api/auth/_log:1 Failed to load resource: the server responded with a status of 500 ()

1 Answers1

0

it could be that you forgot 'secret' option in your [...nextauth].js. It seems to be mandatory since v4 in Prod.

https://next-auth.js.org/getting-started/upgrade-v4#missing-secret

I recently migrated some projects to NextAuth v4.14

import NextAuth from "next-auth"
import GithubProvider from "next-auth/providers/github"
import GoogleProvider from "next-auth/providers/google";
export const authOptions = {
  // Configure one or more authentication providers
  providers: [
    GoogleProvider({
        clientId: process.env.GOOGLE_CLIENT_ID,
        clientSecret: process.env.GOOGLE_CLIENT_SECRET,
        
      })
    // ...add more providers here
  ],
  secret: process.env.SECRET
}
export default NextAuth(authOptions)
PiotrDev
  • 1
  • 1