APP DIR generateStaticParams results in 500 on prod
Unanswered
Asiatic Lion posted this in #help-forum
Asiatic LionOP
Currently using generateStaticParams in an RSC.
This works as expected in dev and my page is correctly cached (otherwise it is not cached)
When I deploy this on Vercel the routes all end up 500 error.
Any ideas are much appreciated.
This works as expected in dev and my page is correctly cached (otherwise it is not cached)
When I deploy this on Vercel the routes all end up 500 error.
Any ideas are much appreciated.
import React from "react";
import { supabaseAdmin } from "@/lib/supabseClient";
import { Story } from "@/lib/types";
import { getAuthor } from "@/lib/apis";
import StoryArea from "@/components/stories/storyArea";
import { StoryPageWrapper } from "@/components/stories/storyPageWrapper";
import { LatestStoryWrapper } from "@/components/stories/latestStoryWrapper";
export const revalidate = 3600;
async function getStoryData(filter?: string): Promise<Story[]> {
if (filter === "All") {
let { data } = await supabaseAdmin
.from("stories")
.select()
.order("date", { ascending: false });
return data as Story[];
} else {
let { data } = await supabaseAdmin
.from("stories")
.select()
.contains("tags", `["${filter}"]`)
.order("date", { ascending: false });
return data as Story[];
}
}
export function generateStaticParams() {
const filters = ["All", "IoT", "Retail", "Safety", "Connectivity"];
return filters.map((filter) => ({
slug: filter,
}));
}
export default async function Page({ params }: { params: { filter: string } }) {
const { filter } = params;
const data = await getStoryData(filter);
const author = await getAuthor(data[0].author);
return (
<StoryPageWrapper>
<LatestStoryWrapper story={data[0]} author={author} />
<StoryArea data={data} />
</StoryPageWrapper>
);
}