generateStaticParams missing error despite it being there
Answered
Selkirk Rex posted this in #help-forum
Selkirk RexOP
First time using
which works fine without
But with it, I'm getting the following:
output: "export" so I might be doing something wrong, but basically, devlogs/[id]/page.jsx has this:export async function generateStaticParams()
{
const files = await fs.readdir("devlogs");
const ids = files.map((file) => file.replace(/\.mdx$/, ""));
return ids.map((id) => ({ params: { id } }));
}which works fine without
output: "export".But with it, I'm getting the following:
> Build error occurred
Error: Page "/devlogs/[id]" is missing "generateStaticParams()" so it cannot be used with "output: export" config.
at E:\Projects\tssite\node_modules\next\dist\build\index.js:1012:59
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Span.traceAsyncFn (E:\Projects\tssite\node_modules\next\dist\trace\trace.js:140:20)
at async Promise.all (index 4)
at async E:\Projects\tssite\node_modules\next\dist\build\index.js:892:17
at async Span.traceAsyncFn (E:\Projects\tssite\node_modules\next\dist\trace\trace.js:140:20)
at async E:\Projects\tssite\node_modules\next\dist\build\index.js:829:124
at async Span.traceAsyncFn (E:\Projects\tssite\node_modules\next\dist\trace\trace.js:140:20)
at async build (E:\Projects\tssite\node_modules\next\dist\build\index.js:187:29)
at async main (E:\Projects\tssite\node_modules\next\dist\bin\next:150:5)Answered by Selkirk Rex
nevermind, messed up my code. its supposed to be
ids.map((id) => ({ id }));2 Replies
Selkirk RexOP
nevermind, messed up my code. its supposed to be
ids.map((id) => ({ id }));Answer
West African Lion
I had this same issue. The error message is quite misleading and frustrating. Your post helped me fix it. Thanks!