0

I am trying to deploy a NextJs application to vercel, I am using next auth to authenticate via discord.

Locally it is working fine. The right callback URL's are all configured and NEXT_AUTH_URL is configured too.

export default NextAuth({
providers: [
    DiscordProvider({
        clientId: process.env.DISCORD_CLIENT_ID,
        clientSecret: process.env.DISCORD_CLIENT_SECRET
    })
],

secret: process.env.SECRET,

jwt: {
    signingKey: process.env.JWT_SIGNING_PRIVATE_KEY,
},

database: process.env.DATABASE_URL,
adapter: PrismaAdapter(prisma),
})

When trying to log in on the deployed site, however, I am receiving a 500 CLIENT_FETCH_ERROR.

J.B.
  • 51
  • 1
  • 2
  • 10

2 Answers2

0

Maybe it is something with keys in enviroment: use keys in this format : process.env.NEXT_PUBLIC_JWT_SIGNING_PRIVATE_KEY

Paiman Rasoli
  • 1,088
  • 1
  • 5
  • 15
0

I have found what it was.

I had made changes to the prisma schema before it stopped working.

Vercel had cached the old prisma client, which was generated with the old schema.

I had to update my build settings and perform a redeployment to clear the cache and regenerate the prisma client to be up to date.

This is the build command I configured on vercel, after that I simply had to trigger a redeployment.

prisma generate && next build
J.B.
  • 51
  • 1
  • 2
  • 10