T
tRPC

❓-help

This page needs to bail out of prerendering at this point because it used revalidate: 0

BHBilly Hawkes1/21/2024
I've been testing out partial prerendering with next using tRPC but having some issues. Everytime I build It breaks ppr due to having a revalidate 0 but I can't find where it occurs. I revalidate in the link is an hour. Here is the server caller I am using:
const createPublicContext = cache(() => {
return createTRPCContext({
headers: new Headers({ cookie: "", "x-trpc-source": "rsc" }),
userId: null,
});
});

export const publicApi = experimental_createTRPCNextAppDirServer<
typeof appRouter
>({
config() {
return {
transformer: SuperJSON,
links: [
loggerLink({
enabled: (op) => true,
}),
experimental_nextCacheLink({
revalidate: 60 * 60,
router: appRouter,
createContext: createPublicContext,
}),
],
};
},
});
const createPublicContext = cache(() => {
return createTRPCContext({
headers: new Headers({ cookie: "", "x-trpc-source": "rsc" }),
userId: null,
});
});

export const publicApi = experimental_createTRPCNextAppDirServer<
typeof appRouter
>({
config() {
return {
transformer: SuperJSON,
links: [
loggerLink({
enabled: (op) => true,
}),
experimental_nextCacheLink({
revalidate: 60 * 60,
router: appRouter,
createContext: createPublicContext,
}),
],
};
},
});
Heres the call that triggers this:
const newReleases = await publicApi.resource.album.newReleases.query();
const newReleases = await publicApi.resource.album.newReleases.query();
And heres the route:
newReleases: publicProcedure.query(async ({ ctx: { spotify } }) => {
return await spotify.browse.getNewReleases();
}),
newReleases: publicProcedure.query(async ({ ctx: { spotify } }) => {
return await spotify.browse.getNewReleases();
}),
All my versions are on "next" All the code can be found here: https://github.com/hackthebois/RecordScratch/tree/ppr Its also odd because sometimes it builds and sometimes it doesn't. Any help is much appreciated.
No description

Looking for more? Join the community!