Next.js Discord

Discord Forum

Failed to collect page data while deploying to Vercel

Unanswered
Rough harvester ant posted this in #help-forum
Open in Discord
Rough harvester antOP
I'm trying to deploy my NextJS project to vercel, and it keeps failing with Error: Failed to collect page data for /api/auth/session. I suspect it's because I'm only running next build as my build command and not prisma generate, too. But I don't know how to add multiple build commands.

I'm using nextAuth, and for some reason the app only worked when I made a /api/auth/session/route.ts file which includes
import { auth } from '@/auth';
import { authConfig } from '@/auth.config';
import getServerSession from 'next-auth';
import { NextResponse } from 'next/server';

export async function GET(request: Request) {
    const session = await auth();
    // console.log(session);
    return Response.json(session);
}


Maybe my special case is causing the error? I'm not sure

0 Replies