weird behavior with unstable_cache

I'm trying to use drizzle with planetscale's database-js inside of an unstable_cache (to leverage the tag caching system).
export async function getArticles() {
return await unstable_cache(
async () => {
return await db.select().from(articles).limit(10);
},
["articles"],
{ revalidate: 3600, tags: ["articles"] }
)();
}
export async function getArticles() {
return await unstable_cache(
async () => {
return await db.select().from(articles).limit(10);
},
["articles"],
{ revalidate: 3600, tags: ["articles"] }
)();
}
pretty simple stuff, but because database-js is based on the fetch api, it breaks when inside of the unstable_cache.
Error: cache: 'force-cache' used on fetch for https://aws.connect.psdb.cloud/psdb.v1alpha1.Database/Execute with 'export const fetchCache = 'only-no-store'
Error: cache: 'force-cache' used on fetch for https://aws.connect.psdb.cloud/psdb.v1alpha1.Database/Execute with 'export const fetchCache = 'only-no-store'
I tried changing the fetch in database-js to use undici's fetch, which fixed the problem, but that doesnt support edge runtime sadly. Anyone any ideas?
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server