**generateStaticParams** can work on cloudflare?

I am heavily using generateStaticParams for generating static files at build time. Is there anyway to get this working?
// src/app/blog/[slug]/index.tsx
import NotionPage from "./components/NotionPage"; // Adjust the import path as necessary
import { getPosts, getRecordMap } from "@/utils/apis";
import { ExtendedRecordMap } from "notion-types";

export async function generateStaticParams() {
const posts = await getPosts();
return posts.map((post: any) => ({ slug: post.slug }));
}

async function getData(slug: string) {
const posts = await getPosts();
const postDetail = posts.find((post: any) => post.slug === slug);
if (!postDetail) {
return null;
}
const recordMap: ExtendedRecordMap = await getRecordMap(postDetail.id);
return recordMap;
}

export default async function Page({ params }: { params: { slug: string } }) {
const recordMap = await getData(params.slug);

if (!recordMap) {
// Handle the case where the data is not found
return <div>Error loading page. Please try again later.</div>;
}

return (
<NotionPage recordMap={recordMap} />
);
}

export const revalidate = 60;
// src/app/blog/[slug]/index.tsx
import NotionPage from "./components/NotionPage"; // Adjust the import path as necessary
import { getPosts, getRecordMap } from "@/utils/apis";
import { ExtendedRecordMap } from "notion-types";

export async function generateStaticParams() {
const posts = await getPosts();
return posts.map((post: any) => ({ slug: post.slug }));
}

async function getData(slug: string) {
const posts = await getPosts();
const postDetail = posts.find((post: any) => post.slug === slug);
if (!postDetail) {
return null;
}
const recordMap: ExtendedRecordMap = await getRecordMap(postDetail.id);
return recordMap;
}

export default async function Page({ params }: { params: { slug: string } }) {
const recordMap = await getData(params.slug);

if (!recordMap) {
// Handle the case where the data is not found
return <div>Error loading page. Please try again later.</div>;
}

return (
<NotionPage recordMap={recordMap} />
);
}

export const revalidate = 60;
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server