weird behavior with nextjs appdir experimental 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?
1 Reply
rq
rq14mo ago
I have the same problem @Merlin did you find any solutions? I'm trying to do some incremental static regeneration by caching my database calls using drizzle orm same like you
Want results from more Discord servers?
Add your server