ard
ard
CDCloudflare Developers
Created by ard on 5/20/2024 in #next-on-pages
I am getting the error `The script will
I am 99% sure it is because of the fetch call inside the metadata, but specifically the fetch(). I was able to avoid the crash by using a timeout on the promise, but it stills gives me the error just prevents the crash
4 replies
CDCloudflare Developers
Created by ard on 5/20/2024 in #next-on-pages
I am getting the error `The script will
This is the code that's causing it:
export async function generateMetadata(
{ params }: Props,
parent: ResolvingMetadata
): Promise<Metadata> {
const { collectionId } = params;

const collections_endpoint = process.env.NEXT_PUBLIC_COLLECTIONS_SERVER;

const response = await fetch(
`${collections_endpoint}/v1/collections/${collectionId}`,
{
method: "GET",
headers: {
Accept: "*/*",
"Accept-Language": "en-US,en;q=0.9",
"Cache-Control": "no-cache",
"Content-Type": "application/json",
},
}
);
export async function generateMetadata(
{ params }: Props,
parent: ResolvingMetadata
): Promise<Metadata> {
const { collectionId } = params;

const collections_endpoint = process.env.NEXT_PUBLIC_COLLECTIONS_SERVER;

const response = await fetch(
`${collections_endpoint}/v1/collections/${collectionId}`,
{
method: "GET",
headers: {
Accept: "*/*",
"Accept-Language": "en-US,en;q=0.9",
"Cache-Control": "no-cache",
"Content-Type": "application/json",
},
}
);
4 replies