Next.js Discord

Discord Forum

Error deploying to vercel

Unanswered
Tonkinese posted this in #help-forum
Open in Discord
TonkineseOP
> Build error occurred
Error: Failed to collect page data for /api/auth/[...nextauth]
    at /vercel/path0/node_modules/next-themes/node_modules/next/dist/build/utils.js:1211:15 {
  type: 'Error'
}
error: script "build" exited with code 1 (SIGHUP)
Error: Command "bun run build" exited with 1


I keep getting this error, but I'm not too sure what it means. I believe I've configured things correctly. Everything works fine locally :spinning_think:

6 Replies

try export const revalidate = 0 in your /api/auth/[...nextauth]/route.ts (assuming you are using app dir route handlers)
also show that file
TonkineseOP
Here's what the file look like. I've just added you're suggestion and am gonna try build 🙂

import NextAuth from "next-auth";

import { authOptions } from "~/server/auth";

// just added this now
export const revalidate = 0;

// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const handler = NextAuth(authOptions);
export { handler as GET, handler as POST };
hmm i haven't needed it for when i used nextjs (i thought i added it), i wonder why yours has error
wait, i didn't see your "next-themes", i wonder how that could be messing with it
@Tonkinese hmm looks like the next/dist/build/utils.js:1211:15 causes issues for other people such as: https://github.com/prisma/prisma/discussions/21870