Everything runs smoothly on npm run dev
.
But when I deploy to Netlify or run npm run build
locally, an error pops up:
app/api/projects/[projectId]/activity/route.ts
Type error: Route "app/api/projects/[projectId]/activity/route.ts" has an invalid "GET" export:
Type "{ params: Record<string, string>; }" is not a valid type for the function's second argument.
The content of
app/api/projects/[projectId]/activity/route.ts
consists of the following:
import { NextRequest, NextResponse } from 'next/server';
import { supabase } from '@/lib/supabase';
export async function GET(
request: NextRequest,
{ params }: { params: Record<string, string> }
) {
try {
const projectId = params.projectId;
const { data, error } = await supabase
.from('activity_log')
.select('*')
.eq('project_id', projectId)
.order('timestamp', { ascending: false });
if (error) throw error;
return NextResponse.json({ activities: data });
} catch (error) {
return NextResponse.json({ error: 'Failed to fetch activity log' }, { status: 500 });
}
}
This is utilizing NextJS version 15. As a beginner, I am open to providing any additional environment or codebase details.
I have attempted various fixes and even rewrote the API routes from scratch, but I continue to encounter the same Type
errors.