I have a problem with my nextjs application which is, I have this
export const dynamic = "force-dynamic";
export const dynamicParams = true;
export async function generateStaticParams() {
const { data } = await fetch(
`${process.env.DOMAIN}/api/product?getall=true&active=true`,
{ cache: "no-store" }
).then((res) => res.json());
if (data.length === 0) {
return [];
}
return data.map((item) => ({
id: item._id,
}));
}
async function getProduct(id) {
const { data } = await fetch(`${process.env.DOMAIN}/api/product/${id}`, {
next: { revalidate: 60 },
}).then((res) => res.json());
if (!data) {
notFound();
}
return data;
}
export default async function ProductPage({ params }) {
const data = await getProduct(params.id);
...
}
i get this error:
I would like to know how to properly implement the static generation of my product list without next build throwing me an error
how can I solve that?
I have tried updating nextjs from 13 to 14, but the problem still persists in this version too