Call retries were exceeded with ssg

I'm running a create-t3-app on Node 18. Has anyone seen errors trying to use SSG with TRPC and Prisma? I'm new to the T3 stack overall so I'm not sure if the error really comes down to Next, Prisma, or TRPC here. But when I try building with the code below, I'll run into Error: Call retries were exceeded, coming from, of all things, next/dist/compiled/jest-worker/index.js, which I thought was super weird. Not sure how this could be related to Jest. There are 1204 cats, so I'm trying to generate 1204 pages here, so maybe that's just too much? I noticed that if I add take: 10 to getStaticPaths, then I don't see this error anymore. But on the other hand, all I'm trying to do to generate each one is just a simple db query. TBH I would have this expected to scale to as many pages as I need to generate here.
export const getStaticProps: GetStaticProps = async (context) => {
const helpers = createServerSideHelpers({
router: appRouter,
ctx: { prisma, auth: {} },
transformer: superjson,
});

const catId = context.params?.catId;
if (typeof catId !== "string") {
// TODO: improve this behavior, maybe go to new page.
throw new Error("Missing params");
}

await helpers.cat.byId.prefetch({ catId });

return {
props: {
catId,
trpcState: helpers.dehydrate(),
},
};
};

export const getStaticPaths: GetStaticPaths = async () => {
const cats = await prisma.cat.findMany({
select: { id: true },
// take: 10,
});
const catIds = cats.map((cat) => ({ params: { catId: String(cat.id) } }));
console.log("CAT LENGTH", cats.length, catIds.length);
return {
paths: catIds,
fallback: "blocking",
};
};
export const getStaticProps: GetStaticProps = async (context) => {
const helpers = createServerSideHelpers({
router: appRouter,
ctx: { prisma, auth: {} },
transformer: superjson,
});

const catId = context.params?.catId;
if (typeof catId !== "string") {
// TODO: improve this behavior, maybe go to new page.
throw new Error("Missing params");
}

await helpers.cat.byId.prefetch({ catId });

return {
props: {
catId,
trpcState: helpers.dehydrate(),
},
};
};

export const getStaticPaths: GetStaticPaths = async () => {
const cats = await prisma.cat.findMany({
select: { id: true },
// take: 10,
});
const catIds = cats.map((cat) => ({ params: { catId: String(cat.id) } }));
console.log("CAT LENGTH", cats.length, catIds.length);
return {
paths: catIds,
fallback: "blocking",
};
};
The error:
error - Error: Call retries were exceeded
at ChildProcessWorker.initialize (/foo-t3-app/node_modules/next/dist/compiled/jest-worker/index.js:1:11661)
at ChildProcessWorker._onExit (/foo-t3-app/node_modules/next/dist/compiled/jest-worker/index.js:1:12599)
error - Error: Call retries were exceeded
at ChildProcessWorker.initialize (/foo-t3-app/node_modules/next/dist/compiled/jest-worker/index.js:1:11661)
at ChildProcessWorker._onExit (/foo-t3-app/node_modules/next/dist/compiled/jest-worker/index.js:1:12599)
1 Reply
xdxd#5555 / hanya
I'm thinking that if I simply cannot feasibly return 1000 paths from getStaticPaths, I should just use incremental static regeneration and let most pages be built the first time they're served