Nextjs@15.1.0 Fails to build api routes
Answered
AM posted this in #help-forum
AMOP
I have following api route:
But on build i get following error:
https://pastebin.com/Uf3r1wNW any ideas?
http://localhost:3001/api/trending/{id}
import { neynar } from '@/lib/services/Neynar';
import { augmentCasts } from '@/lib/utils';
import { fetchTrendingPosts } from '@/lib/utils/neynar';
import { NextRequest, NextResponse } from 'next/server';
export async function GET(
request: NextRequest,
{ params }: { params: Promise<{ fid: string }> }
) {
const { fid } = await params;
const castsWithScores = await fetchTrendingPosts({
fid: Number(fid)
});
if (!castsWithScores) {
return {
casts: []
};
}
const hashes = castsWithScores.map((cast) => cast[0]);
const response = await neynar.getBulkCasts(hashes);
const augmentedCasts = await augmentCasts(response.result.casts);
return NextResponse.json({
casts: augmentedCasts
});
}
But on build i get following error:
https://pastebin.com/Uf3r1wNW any ideas?
Answered by joulev
not
but
return {
casts: []
};
but
return NextResponse.json({
casts: []
});