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

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...
No description

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?...

Worker request time increased drastically after deployment

Hey there, before my deployment i had a quite low request time, usually below a second, only a few hundred milliseconds. But all of a sudden after a few deployments my worker request times went up to 4 or 5 seconds. My worker really doesnt do much besides a few DB requests and console logs, but no extreme loops or anything, and is written in js. The only thing i changed was adding a lookup table for country codes to get the country the request was made from, so ```js const countryLookup = { AF: 'Afghanistan',...

Service bindings not working: Error - env is not defined

I want to order a paid service, if I am able to make my project work. But this is not working. There are many other posts, which shows this area is not working properly. So I am trying to determine, if this can work for me. The service bindings in the example on Cloudflare docs refers wrangler. I am trying to setup HTTP service bindings between two workers without wrangler. For testing, I have used and setup an example and have implemented exactly from below:...

can a worker parse an JSON email attachment and connect with an API?

I'm new to this and seeing if this is a viable option for what I'm trying to do. I have a bed and breakfast, and my system sends out a JSON attachment in an email everyday with the day's guests and their contact info. I need to get the phone numbers from that attachment and send it to an API to update door codes. Is this an appropriate use case for workers? If so, Where should I get started?...