Getting error only in production and not locally

Getting this error in production
# SERVER_ERROR: TypeError: Cannot read properties of undefined (reading 'serialize')
at h (.next/server/app/api/chat/route.js:4:53602)
at <unknown> (.next/server/app/api/chat/route.js:4:53246)
at async Object.r [as handler] (.next/server/chunks/1768.js:4:26301)
at async y (.next/server/chunks/1768.js:33:288413)
at async r.<computed> (.next/server/chunks/1768.js:33:290289)
at async n (.next/server/chunks/1768.js:33:2763)
at async handler (.next/server/chunks/1768.js:33:3037)
# SERVER_ERROR: TypeError: Cannot read properties of undefined (reading 'serialize')
at h (.next/server/app/api/chat/route.js:4:53602)
at <unknown> (.next/server/app/api/chat/route.js:4:53246)
at async Object.r [as handler] (.next/server/chunks/1768.js:4:26301)
at async y (.next/server/chunks/1768.js:33:288413)
at async r.<computed> (.next/server/chunks/1768.js:33:290289)
at async n (.next/server/chunks/1768.js:33:2763)
at async handler (.next/server/chunks/1768.js:33:3037)
however, things work perfectly locally .. what could be the issue? I'm using better-auth with nextjs. here is roughly what my config looks like
export const auth = betterAuth({
database: drizzleAdapter(db, {
provider: "pg",
schema,
}),
plugins: [
jwt({
jwt: {
expirationTime: "1h",
},
jwks: {
keyPairConfig: {
alg: "EdDSA",
crv: "Ed25519",
},
},
}),
],
advanced: {
database: {
generateId: () => uuidv4(),
},
},
socialProviders: {
google: {
clientId: process.env.GOOGLE_CLIENT_ID || "",
clientSecret: process.env.GOOGLE_CLIENT_SECRET || "",
},
},
});
export const auth = betterAuth({
database: drizzleAdapter(db, {
provider: "pg",
schema,
}),
plugins: [
jwt({
jwt: {
expirationTime: "1h",
},
jwks: {
keyPairConfig: {
alg: "EdDSA",
crv: "Ed25519",
},
},
}),
],
advanced: {
database: {
generateId: () => uuidv4(),
},
},
socialProviders: {
google: {
clientId: process.env.GOOGLE_CLIENT_ID || "",
clientSecret: process.env.GOOGLE_CLIENT_SECRET || "",
},
},
});
2 Replies
edwardrenton
edwardrenton2mo ago
did you solve this? also getting this in prod but not local
nikatune
nikatune2mo ago
at h (.next/server/app/api/chat/route.js:4:53602) whats in route.js ?

Did you find this page helpful?