MrLabubu =)))
MrLabubu =)))
CDCloudflare Developers
Created by MrLabubu =))) on 3/2/2024 in #workers-help
Cloudflare worker Cache not work
oh found the issue, Cache API is not enabled on workers.dev
6 replies
CDCloudflare Developers
Created by MrLabubu =))) on 3/2/2024 in #workers-help
Cloudflare worker Cache not work
hi any advise?
6 replies
CDCloudflare Developers
Created by MrLabubu =))) on 3/2/2024 in #workers-help
Cloudflare worker Cache not work
I put the X-From-Cache - If it hit cache it will be true, but always false. the response always null, so the code always go to Model - hit database and get data, not from cache
6 replies
CDCloudflare Developers
Created by MrLabubu =))) on 3/2/2024 in #workers-help
Cloudflare worker Cache not work
I am not sure, the let response = await cache.match(cacheKey); always return null. so I guest the ctx.executionCtx.waitUntil(cache.put(cacheKey, response.clone())); not working. But it not go to the catch error, just no err show
6 replies
CDCloudflare Developers
Created by MrLabubu =))) on 2/21/2024 in #workers-help
Issue connect Worker and Planetscale
found the issue: When I test in local -> its not working. If I deploy to cloudflare -> its OK. How to fix this?
3 replies
CDCloudflare Developers
Created by MrLabubu =))) on 2/21/2024 in #workers-help
Issue connect Worker and Planetscale
tried the code from https://developers.cloudflare.com/workers/databases/native-integrations/planetscale/ but still same issue import { connect } from '@planetscale/database'; export default { async fetch(request, env) { const config = { host: env.DATABASE_HOST, username: env.DATABASE_USERNAME, password: env.DATABASE_PASSWORD, // see https://github.com/cloudflare/workerd/issues/698 fetch: (url, init) => { delete (init)["cache"]; return fetch(url, init); } } const conn = connect(config) const data = await conn.execute('SELECT * FROM products;') return new Response(JSON.stringify(data.rows), { status: 200, headers: { 'Content-Type': 'application/json' } }); }, };
3 replies