#APP DIR generateStaticParams results in 500 on prod

3 messages · Page 1 of 1 (latest)

grim magnet
#

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.

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>
  );
}
jagged flameBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

mint ether