I am working on a project with a few of my fellow students colleagues. The website runs locally exactly how it is supposed to.
Env variables:
### NextAuth ###
NEXTAUTH_URL="https://placeholder-for-our-domain"
NEXTAUTH_SECRET=placeholder-for-our-secret
### Google OAuth configuration ###
GOOGLE_CLIENT_ID=placeholder-for-our-clientid
GOOGLE_CLIENT_SECRET=placeholder-for-our-secret
The env variables work locally and the NEXTAUTH_URL is just our normal https domain.
Authentication provider:
const options: AuthOptions = {
secret: process.env.NEXTAUTH_SECRET,
session: {
strategy: "jwt",
},
providers: [
GoogleProvider({
clientId: process.env.GOOGLE_CLIENT_ID,
clientSecret: process.env.GOOGLE_CLIENT_SECRET,
}),
pages: {
signIn: "/auth/sign-in",
error: "/auth/error",
},
};
But when I try it out on our production server I get an HTTP 500 error and this is my console output:
⨯ TypeError: Cannot read properties of undefined (reading 'bind')
at h (.next/server/app/api/auth/[...nextauth]/route.js:34:33240)
at d (.next/server/app/api/auth/[...nextauth]/route.js:34:32880)
at a (.next/server/app/api/auth/[...nextauth]/route.js:17:23682)
at async e.length.t (.next/server/app/api/auth/[...nextauth]/route.js:17:25043)
I have asked Claude 3.7, ChatGPT, searched through similar questions on Stack Overflow, even GitHub questions.