Next.js Discord

Discord Forum

Build error when using Dynamic Route Segments

Unanswered
Lionhead posted this in #help-forum
Open in Discord
LionheadOP
Build error occurred
[Error: Failed to collect page data for /api/contact-match/[matchId]] {
type: 'Error'
}

Hello, I've get this build error. Any ideas how I can solve it?

Build error occurred
[Error: Failed to collect page data for /api/contact-match/[matchId]] {
  type: 'Error'
}


export async function POST(
  request: NextRequest,
  { params }: { params: Promise<{ matchId: string }> },
) {
  try {
    const formData = await request.json();
    const matchId = (await params).matchId;

    const response = await http.post(
      `${process.env.NEXT_PUBLIC_REGEN_MATCH_API_URL}/mentor/${matchId}/contact`,
      formData,
    );
    return createResponse(response);
  } catch (err) {
    return handleErrorResponse(err);
  }
}

0 Replies