How to debug Vercel cache misses with tRPC?

Basically. I have a tRPC endpoint with the following NextApiHandler config:
export default createNextApiHandler({
router: appRouter,
createContext: createTrpcContext,
responseMeta: (opts) => {
const { paths, errors, type } = opts;

if (
paths &&
paths.every((path) => path === "tournaments.getTournamentInternal") &&
errors.length === 0 &&
type === "query"
) {
return {
headers: { "cache-control": `max-age=0, s-maxage=30` },
};
}

return {};
},
onError:
env.NODE_ENV === "development"
? ({ path, error }) => {
console.error(`❌ tRPC failed on ${path}: ${error}`);
}
: undefined,
});
export default createNextApiHandler({
router: appRouter,
createContext: createTrpcContext,
responseMeta: (opts) => {
const { paths, errors, type } = opts;

if (
paths &&
paths.every((path) => path === "tournaments.getTournamentInternal") &&
errors.length === 0 &&
type === "query"
) {
return {
headers: { "cache-control": `max-age=0, s-maxage=30` },
};
}

return {};
},
onError:
env.NODE_ENV === "development"
? ({ path, error }) => {
console.error(`❌ tRPC failed on ${path}: ${error}`);
}
: undefined,
});
Right now even if I make 2 requests within a fairly short time I end up with a cache miss. How can I debug this?
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server