im using Next.js 14.2.4
this is mine app/api/auth/[…nextauth]/route.ts
in npm run dev all works fine, but when I go npm run build I get this error:
app/api/auth/[…nextauth]/route.ts
Type error: Route “app/api/auth/[…nextauth]/route.ts” does not match the required types of a Next.js Route.
“handler” is not a valid Route export field.
import NextAuth, { AuthOptions } from 'next-auth';
import GoogleProvider from 'next-auth/providers/google';
import clientPromise from '../../../../lib/db';
import { MongoDBAdapter } from '@next-auth/mongodb-adapter';
export const authOptions: AuthOptions = {
adapter: MongoDBAdapter(clientPromise),
providers: [
GoogleProvider({
clientId: process.env.GOOGLE_ID ?? '',
clientSecret: process.env.GOOGLE_SECRET ?? '',
authorization: {
params: {
prompt: 'consent',
access_type: 'offline',
response_type: 'code',
},
},
profile(profile) {
return {
id: profile.sub,
name: profile.name,
email: profile.email,
image: profile.picture,
};
},
}),
// ...add more providers here
],
};
const handler = NextAuth(authOptions);
export default handler;
export { handler as GET, handler as POST };
Im expecting to solve the npm run build, I tried to change the export defaults
hello world you fcking suck is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.