Hi everyone,
In the “Preparing to Deploy” tutorial, when we run npm run build
, we get the above stated error.
I know Mosh explained the solution to create a separate script for authOptions
and then import it in [...nextauth]/route.ts
and the error goes away.
Question here:
How does this solve the underlying issue? which is that we can’t export an invalid Route export field. ?
I mean to ask: we still export authOptions
as handler
in route.ts
, as follows:
const handler = NextAuth(authOptions)
export { handler as GET, handler as POST }
So, how does the error go away?