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

CF-Worker and MongoDB connection and performance is very slow

I'm working with Cloudflare Workers and MongoDB, but I'm noticing that the connection and performance are really slow. Has anyone else experienced this, or know how to optimize the connection and improve the performance? Any tips or advice would be appreciated! 🙏...

Whats the best way to push worker logs into a Graphana Loki instance?

Whats the best way to push worker logs into a Graphana Loki instance?

CLW error:

(error) SyntaxError: Unexpected token 'e', "error code: 1042" is not valid JSON fetch worker => worker, error, help...

Observability

Hey folks, you have 3 links on this page, they all lead to the same page and that does not explain what setting observability.enabled = true actually does :/
No description

Scheduled Worker failed(?) halfway but no errors shown.

Hi all! I'm facing the a problem with scheduled worker that runs every minute, The worker does the following: 1. Query an API that returns ~1000 data points 2. Loop through the data points and see if we find any thing that match a certain criteria 3. If yes, send a message to Telegram (bot) & discord (using webhook) ---...

Free Tier Subrequests 50/request??

How many subrequests can I make? The limit for subrequests a Worker can make is 50 per request on the Bundled usage model or 1,000 per request on the Unbound usage model. Each subrequest in a redirect chain counts against this limit. This means that the number of subrequests a Worker makes could be greater than the number of fetch(request) calls in the Worker. For subrequests to internal services like Workers KV and Durable Objects, the subrequest limit is 1,000 per request, regardless of the usage model configured for the Worker. ...

How to cache worker response?

I want to cache worker response, so that when the next request comes in, there will be no worker invocation.

Get Current Worker file

As you guys know quick edit is no longer available in Android cloudflare site which was used to quick edit and get current worker file. So now my question is:
How can I get my currently deployed worker file.
How can I get my currently deployed worker file.
I can't find any option like using wrangle and site....

RPC not working with getters

The error says that bar is not a function. I'm looking to call WORKER.foo.bar() instead of WORKER.foo().bar(). ```ts class Foo extends RpcTarget { bar() { return "baz"...

The requested Worker version could not be found, please check the ID being passed and try again.

#workers-help The requested Worker version could not be found, please check the ID being passed and try again. (Code: 100146) I am trying to use this repository to deploy a worker and I am having issues...

Scheduled worker gets an error in production, not locally

I have a scheduled task worker that does a fetch call to an API and then does some work with the results. This is all running fine locally. However, in production, when I make a fetch call to the remote API, I get: “error code: 521”. To be clear, the same fetch() call is run in dev versus production. On a whim, I then built a whole new Worker, HTTP based, copied and pasted the function that makes the fetch() call, and it works fine. Here's the worker, https://github.com/cfjedimaster/cloudflareworkers-demos/blob/main/scratchworker/src/index.js, and here is (virtually) the same worker as a HTTP service that runs just fine: https://github.com/cfjedimaster/cloudflareworkers-demos/blob/main/getincidents/src/index.js As I said, if I test locally, it's perfect....

Cache access token requested from an API and use it in the subsequent requests

Hi, I'm looking for a way to cache an access token which is returned from an external API by making a POST request (by passing the username and password in the request body). This access token is valid for 1 week (604800 seconds). Is there a way to cache this token that is being returned as part of the response body? There are two additional API calls (1 POST + 1 GET) within the same worker that uses this access token to get additional data from the API server (that is never cached). At this moment, every time I call worker endpoint, it generates a new token during the 1st call. I'm looking to avoid that and reuse the same token for those additional 2 calls....

Wildcard DNS with workers on a custom domain

I found a bunch of discussions, but still confused. I have a worker with a custom domain and a route defined:
route = { pattern = "*example.com/*", zone_name = "example.com" }
route = { pattern = "*example.com/*", zone_name = "example.com" }
...

Using a proxy server with fetch

I am rewriting an API which heavily relies on proxies to use workers with hono. I have done some googling and the top results for node.js don't apply here. Is there a way to use an http proxy with the browser native fetch API provided by workers?

Old assets availability with `--old-asset-ttl`

I'm trying to make outdated assets from the previous deployment available using --old-asset-ttl option (Thanks for @Peter Belbin https://github.com/cloudflare/workers-sdk/pull/3384). Unfortunately, assets aren't available using the old link from the browser after deployment. They are still in KV as expected but are not present in __STATIC_CONTENT_MANIFEST anymore. So can't be reached from browser by initial name (without hash prefix). I'm using a custom build with webpack to build my React app (not Wrangler internal bundler) and npx wrangler deploy -c wrangler.toml -e "<MY_ENV>" --old-asset-ttl=43200 to deploy. ...

Switch account deployment targets

I have one Cloudflare profile that has access to multiple accounts (sounds confusing but that's what "organizations" are called I guess) I started a worker on one account but want to deploy to a different. I feel like this should be trivial but I can't find any way to do it When I create a new worker it asks me which account but then hides it from me?...

Stripe error 500

Locally with the test keys everything works fine but when I upload it to cloudflare and I get error 500 when I try to make the payment. Here is a video of the error: https://vimeo.com/1008446499/5cb3ef6b59?share=copy...

525 Error when making API Call over worker

hey there, I get a 525 error when I try to use the DeepL API from my worker. It works just fine locally and the issue only appears once deployed to production. From researching its got something to do with the SSL handshake between CF and the API but I haven't found a solution, anyone know how to solve it? `export async function translateHtml(htmlContent, sourceLang, targetLang, env) { try { console.log('Translating HTML content...');...