I ran into this same issue and was able to resolve it with the following type cast:
const handler = NextAuth(authOptions) as (request: Request) => void; export { handler as GET, handler as POST };