Cloudflare Developers

CD

Cloudflare Developers

Welcome to the official Cloudflare Developers server. Here you can ask for help and stay updated with the latest news

Join

workers-help

pages-help

general-help

durable-objects

workers-discussions

pages-discussions

wrangler

coding-help

kv

🦀rust-on-workers

miniflare

stream

general-discussions

functions

zaraz

âš¡instant-logs

email-routing

r2

pubsub-beta

analytics-engine

d1-database

queues

workers-for-platforms

workerd

web3

🤖turnstile

radar

web-research

logs-engine

cloudflare-go

terraform-provider-cloudflare

workers-ai

browser-rendering-api

analytics

next-on-pages

cloudflare-ai

build-caching-beta

hyperdrive

vectorize

ai-gateway

How do you execute D1 migration with Worker Build?

Is it possible to perform migration to d1 by CI/CD with workers build? Currently, I have set up a deploy command that executes bunx wrangler d1 execute migration apply and bunx wrangler deploy in sequence. How do you guys do it?

Preview deployments for workers with Durable Objects

We're very interested in using the new Preview Deployments feature for our workers in Cloudflare, but after spending some time trying to figure out how to enable them, it seems the feature isn't available if the worker uses a Durable Object? Is this on the roadmap or is there a fundamental constraint here? Is there a way around this?

Workers duration limit confusion

Use event.waitUntil() to delay cancellation for another 30 seconds or until the promise passed to waitUntil() completes.
The docs on Duration Limit (https://developers.cloudflare.com/workers/platform/limits/#duration) says that using waitUntil() delays Worker expiration untils 30 secs *or * the promise completes. The "or" is confusing me. Does that mean it'll continue for the longer of the two (and potentially indefinitely while awaiting the Promise)?...

Resizing a private image in an R2 bucket through a worker

```ts export default { async fetch(request, env): Promise<Response> { const url = new URL(request.url); const key = url.pathname.slice(1);...

Using `ctx.waitUntil()` in SvelteKit environment

Hello, I am writing caching logic for a service on my SvelteKit app and I would like to be able to use the waitUntil() method to run post-lookup operations after sending the client a response. after debugging an error I was getting, i found that ctx itself was not being passed in the request object at all. my +server.ts code looks something like this: ``` export const GET = async (request) => { const { ctx, env } = request.platform || {};...

Basic Auth in i40west’s

That looks like what the Basic Auth in i40west’s example Worker would do. How to enable Basic Auth step by step Thanks...

Worker 403 error with custom headers, worked fine a few weeks ago

I am using a worker as a proxy to bypass CORS. When using it without custom headers, it doesn't fetch anything and returns the correct response. When used with custom headers (urlToFetch), it used to correctly return the fetched content. But now it returns this instead: ``` We are sorry ! The page or file you requested is not accessible. Please try after some time....
No description

MTA-STS worker example serving policy data directly

This example worker serves MTA-STS policy data directly. Adapt the reply variable to your needs and add this worker to each domain as a custom subdomain mta-sts.<your_domain>. This is a companion to -> https://github.com/fry69/certbot-cloudflare-dns-updaters ```ts export default { async fetch(request, env, ctx) { const url = new URL(request.url);...

D1 is so much slow : take 600+ms for a single user

I have connect d1 from cloudflire worker and used 'itty-router' Here is my code: const { results } = await env.DB.prepare(SELECT * FROM users).all(); return json(results);...

Durable object resets value on each request to Worker

According to the docs I've created an durable object: ```yaml [[durable_objects.bindings]] name = "COUNTERS" class_name = "UserIdCounter"...
No description

next.js worker not finding environment variables

hi! i have a cloudflare worker that i'm trying to deploy and have environment variables that i'm using. i've added the environment variables within the env variables within the worker but the build isn't able to find it (i'm using https://github.com/t3-oss/t3-env to manage my env variable validations). would anyone know how i can further debug this issue? if i have a local .env file, the build works smoothly and as such believed the worker build environment would read from the environment variables ...
No description

Cron job runs in dev when it should be disabled

My worker.toml is configured like this: ```toml [triggers] crons = ["*/10 * * * *"]...

Need the confimation about my code

import { generateJWT } from '../utils/jwt'; export const getComponentById = async (request: Request, env: Env) => { const queryParams = new URL(request.url).searchParams; const componentId = queryParams.get('id');...

worker not returning google Oauth2 refresh_token

I am using google Oauth2 for fetching all token(access_token and refersh_token). I am getting all token all local envirnment but Same code it not returning Refresh_token. I am getting all token except refresh_token. Api response is success but missing refresh_token fields. Is there any field level filter their in cloudflare?...

worker analytics have hits but sql * from dataset returns 0 rows

i'm sending data to worker analytics. no errors recorded, and dashboard shows data coming in - but sql query returns 0 rows. what could I be doing wrong?

Is it possible to use the Rate Limit API within an app created with Astro?

I am trying to use the new beta rate limit API in my application that is created using Astro. I understand how the runtime api and context works - but it seems to fail when trying to use the new Rate Limit API. Is there an example of this somewhere, or is it not possible?

Registered with the wrong Email

I Registered with the wrong Email can i get a admin to update it on the accout so i can veriy my account please?

What happens when Email Workers go over the limit on a Worker/Page Free Plan?

Curious about exploring email workers and want to know limitations

mongodb

Hey Workers team, when will you support TLS in your runtime - Question asked by a MongoDB employee. https://alexbevi.com/blog/2024/09/11/why-cloudflare-workers-dont-work-with-mongodb/...

Cache API usage in worker to cache POST requests.

Hey I wanted to cache POST requests to one of my APIs and I seem to be stuck with CacheAPI. That's the code: https://anonpaste.io/share/29c8fc4d04 (sorry for link but there is char limit of 2000). I'm never getting anything out of cache, despite the cache.put being ok. As you can see that cache CHANGES the original URL so kinda tries to act like a caching proxy for POST urls. What am I doing wrong here?...
Next