planetscale cache error

not sure if the issue is from drizzle or trpc, but trying to query the db via the RSC api fails with this error
result: {
data: {
secret: null,
error: [Error: cache: 'force-cache' used on fetch for https://aws.connect.psdb.cloud/psdb.v1alpha1.Database/Execute with 'export const fetchCache = 'only-no-store']
}
},
elapsedMs: 14
result: {
data: {
secret: null,
error: [Error: cache: 'force-cache' used on fetch for https://aws.connect.psdb.cloud/psdb.v1alpha1.Database/Execute with 'export const fetchCache = 'only-no-store']
}
},
elapsedMs: 14
3 Replies
Angelelz
Angelelz14mo ago
Are you using nextjs?
Liltripple_reid
Liltripple_reidOP14mo ago
yea next 13.5.4 weird thing is that doing this:
// async function Something
const data = await db.query.table.findMany()
// async function Something
const data = await db.query.table.findMany()
works nicely, but using the trpc helper does not
import { loggerLink } from "@trpc/client";
import { experimental_nextCacheLink as nextCacheLink } from "@trpc/next/app-dir/links/nextCache";
import { experimental_createTRPCNextAppDirServer as createTRPCNextAppDirServer } from "@trpc/next/app-dir/server";
import { cookies } from "next/headers";
import SuperJSON from "superjson";
import { getUserAuth } from "../auth/utils";
import { appRouter } from "../server/routers/_app";

/**
* This client invokes procedures directly on the server without fetching over HTTP.
*/
export const api = createTRPCNextAppDirServer<typeof appRouter>({
config() {
return {
transformer: SuperJSON,
links: [
loggerLink({
enabled: () => true,
}),
nextCacheLink({
revalidate: 1,
router: appRouter,
async createContext() {
const { session } = await getUserAuth();
return {
session,
headers: {
cookie: cookies().toString(),
"x-trpc-source": "rsc-invoke",
},
};
},
}),
],
};
},
});
import { loggerLink } from "@trpc/client";
import { experimental_nextCacheLink as nextCacheLink } from "@trpc/next/app-dir/links/nextCache";
import { experimental_createTRPCNextAppDirServer as createTRPCNextAppDirServer } from "@trpc/next/app-dir/server";
import { cookies } from "next/headers";
import SuperJSON from "superjson";
import { getUserAuth } from "../auth/utils";
import { appRouter } from "../server/routers/_app";

/**
* This client invokes procedures directly on the server without fetching over HTTP.
*/
export const api = createTRPCNextAppDirServer<typeof appRouter>({
config() {
return {
transformer: SuperJSON,
links: [
loggerLink({
enabled: () => true,
}),
nextCacheLink({
revalidate: 1,
router: appRouter,
async createContext() {
const { session } = await getUserAuth();
return {
session,
headers: {
cookie: cookies().toString(),
"x-trpc-source": "rsc-invoke",
},
};
},
}),
],
};
},
});
this is the RSC API generated by kirimase for context if you want to try
Angelelz
Angelelz14mo ago
Well, I asked about next because they patched the fetch function with their aggressively cached version So that's your problem in my opinion
Want results from more Discord servers?
Add your server