SearchGet Started
Cloudflare Developers

workerd-runtime

in Cloudflare Developers

Channels

general-helppages-helpworkers-and-pages-helpdurable-objectsworkers-and-pages-discussionspages-discussionswranglercoding-helpkv🦀rust-on-workersminiflarestreamgeneral-discussionsfunctionszaraz⚡instant-logsemail-routingr2pubsub-betaanalytics-engined1-databasequeuesworkers-for-platformsworkerd-runtime🤖turnstileradarlogs-enginecloudflare-goterraform-provider-cloudflareworkers-aibrowser-rendering-apilogs-and-analyticsnext-on-pagescloudflare-aibuild-caching-betahyperdrivevectorizeai-gatewaypython-workers-betavitest-integration-betaworkers-observabilityworkflowsvite-pluginpipelines-betacontainers-beta

Threads

Product

PricingDocsCommunities

Resources

AboutBlogChangelogContributors

Legal

TermsPrivacyCookiesEULA
TwitterGitHubDiscord

© 2026 Hedgehog Software, LLC. All rights reserved.

Worker-based threading
FrozenFireF
FrozenFire7/18/25, 7:22 PM
Can I instantiate within the context of a worker? I'm attempting to shim a Rust wasm worker to support (https://github.com/tlsnotary/tlsn-utils/blob/dev/web-spawn/js/spawn.no-bundler.js), which is a refactored version of wasm-bindgen-rayon.

The WASM I'm building depends heavily on "threading", but it will likely work to simulate it with the workerd global event loop.
WASM App
bpenceB
bpence6/20/25, 4:57 PM
Hi. I’m not sure if this is the best place to ask this, but I’m developing a WASM client-server app and saw something about cloudflare being able to serve that out pretty well and cheap. Can someone tell me if that’s what the workers do? I have no experience with cloudflare and the website is using a lot of terms I’ve never been exposed to and can’t make sense of it.
* [Accounts, zones, and profiles](https://developers.cloudflare.com/fundamentals/setup/accounts-and-
huwH
huw4/14/25, 5:57 AM
I got MongoDB connection pooling working by using a Durable Object!

My looks like this. I’ve provided a to my DO, based on where my MongoDB databases are:



Then looks like this:



This code just transparently forwards all requests straight onto the DO, which can hold onto the connection pool across multiple requests and re-use it. My end-to-end timings went from ~2000ms to ~300ms after doing this!

(Also cross-posted this to the workerd discussion above)
@Hard@Work , @Dan Lapid I found the
AshkanA
Ashkan2/10/25, 6:30 PM
@Hard@Work , @Dan Lapid I found the source of internal errors and reached from Error Rate to Error Rate. I am not sure if this fix is related to cloudflare back changes OR my changes in the source code. I have put the worker in the load to see if it really fix or not. if it fixed I will make a Github issue and explain the whole problem there.
Internal Error Debugging
AshkanA
Ashkan2/10/25, 11:51 AM
thanks for reply, In my deployed worker It shows many internal errors and also when I debug it locally, when I do put code blocks into also it doesn't work and the internal errors are not caught and have not informative message to fix the bug, It only shows Internal error message nothing else.
let clarify it, I want to locate the
AshkanA
Ashkan2/9/25, 4:20 PM
let clarify it, I want to locate the part of the code that causes internal error.
Error on running tests
Suman!S
Suman!10/1/24, 3:27 PM
Hey guys, I am getting this error when running test with vitest. I have set the new_sqlite_classes in migrations but still get this error. I would like to know where exactly to set ? -> To enable it, set in your workerd config for the class. If using wrangler, under in wrangler.toml, change to . Note that this change cannot be made after the class is already deployed to production.
Thanks in advance
👋 I started seeing some illegal
alanA
alan9/5/24, 1:27 AM
👋 I started seeing some illegal invocation errors from my logging tail worker. i am currently using the datadog client to forward my tail worker logs to my datadog.

i have updated wrangler and the datadog client but the issue still persists. has anyone encountered a similar issue before?

Thank you!
Average worker cost per day 7.86m requests, median CPU time 3293.6ms
ItsWendellI
ItsWendell8/20/24, 1:18 PM
That is quite an expensive worker sir, it's not going to be cheap. You also have a very high Median CPU time, which would be your primary cost. I'm assuming you run some type of compute-heavy WASM stuff on there? I recommend investing time into getting this metric down as low as possible. I did some quick ChatGPT math:

Requests:10 million included per month + $0.30 per additional million
CPU Time: 30 million CPU milliseconds included per month + $0.02 per additional million CPU milliseconds

Total Monthly Cost $15,598.81 | Daily Average Cost $519.96
Hey guys, I'm very desperate with a
quamboQ
quambo7/8/24, 10:14 AM
Hey guys, I'm very desperate with a worker problem that we're fighting with for many weeks now and that the CF support team told me to look on discord from devs for help. Our platform is making a lot of requests to quickbooks API through a cloudflare worker, and we're getting a LOT of 403 errors when trying to fetch quickbooks from the CF worker.

We've escalated this pretty high up with quickbooks, but they've debugged this and insist that our request are not hitting their APIs. I have no idea where the 403 may come from. We use WAF for incoming requests, but this should not touch outgoing requests.

We ONLY see this happening on production. On local development we never get these errors, even when doing the same workload locally.

The error started popping up without explanation, no changes to infra or our code. It just started some day. The error often goes away if we retry, but sometimes it even happens 6 times in a row (often it works after 2-3 retries). It also happens if we reduce concurrency.

We use typescript workers with fetch(), so nothing fancy.

At this point I really don't know where to look at. Is there anything you guys can advice us to check for? My only idea remaining idea right now is to switch production to use something like fly instead of workers, since things seems to work well outside of CF production systems.

Would love to find a way getting it to work on CF, we're really huge believers of the platform.
Hey all, wondering if anyone could help
SamS
Sam7/7/24, 6:49 PM
Hey all, wondering if anyone could help me figure out some workerd/miniflare/wrangler oddities I'm seeing. It's been going on for a while but I think I'm just starting to realize what's going on:

Sometimes on my machine, websocket requests get "delayed" before ever hitting my handler code (doesn't seem related to durable objects, where it eventually ends up, but they don't even hit my regular fetch handler).

There seems to be a queue of WS requests that cause a traffic jam -- eventually if I leave workerd/miniflare running for long enough it seems to process all of them and return to normal, but it can be 10-15 minutes before that happens.

To add to the mystery, it seems different browsers make a difference - my regular Chrome window can get backed up, but then if I open an incognito browser, they immediately go through (while the regular browser one is still pending). Maybe something with headers/cookies? In both browsers, they immediately appear in the network tab, but in the regular Chrome window they're marked pending until workerd sorts through the requests.

Not even remotely sure what could cause this, but has anyone seen anythign similar?
I have run into this just now. My
shaderkyle_ | SolSentryBotS
shaderkyle_ | SolSentryBot3/30/24, 8:01 PM
I have run into this just now. My project ~11k lines of code, which is not small but should be supported. Please don't ignore this issue, it's a showstopper!
hey guys! implementing a POC with
niconiahiN
niconiahi3/22/24, 6:36 PM
hey guys! implementing a POC with by consuming a WASM file. I'm missing how to tell my entrypoint to basically proxy the request to the WASM binary (proxy request from one module to the other). Why? you may ask. Because this WASM binary is a Go webserver so it knows how to handle them. Can someone point me out in the right direction?

I'll leave the files contents in a thread
At this stage - not looking for anything
jackJ
jack2/10/24, 6:01 PM
At this stage - not looking for anything particularly exotic - a couple of hello worlds plus a bit of branched logic using KV store would suffice for now... just to understand how the capn proto config maps to workerd. Also, I'm unclear how workerd routes incoming requests to specific requests. The cap 'n proto example configs in the gh repo are all about binding to an ip:port whereas inbound requests to workerd are pretty much only going to be distinguishable based on their URI or URI path. I did not see anything about routing or pathnames in the schema - however I may have missed something.
Is there something special you need to
niels7N
niels71/19/24, 7:06 PM
Is there something special you need to do to get local Chrome DevTools profiling working properly? I'm trying the following (with wrangler 3.22.3):

  • push 'd' to open chrome devtools, which opens `https://devtools.devprod.cloudflare.dev/js_app?theme=systemPreferred&ws=127.0.0.1%3A9229%2Fws&domain=(REDACTED)&debugger=true
  • Confirm source files appear under "Sources" tab
  • in devtools->Profiler, click start
  • send a request to the local port, confirm the request appears in the devtools network tab
  • stop profiling
  • All I see in the CPU profile is (program), without any detail on the actual function calls (see screenshot)
  • I get the same result if I try and then "Open dedicated DevTools for Node" (see 2nd screenshot)
ec6b5d6e-3fd8-4911-bc92-bf50498028ec.png
Screenshot_2024-01-19_at_11.00.33_AM.png
Hi everyone, hope your holidays are
LukeL
Luke12/27/23, 10:42 PM
Hi everyone, hope your holidays are going well!
I'm building a worker that uses to Shopify and I'm curious how I can debug this locally.
I use which forwards the request on to the origin (Shopify) but locally it it won't know where the origin is. If I overwrite the url to fetch from Shopify it will hit my worker in production. How are others working around this w/ ?
Working on it as we speak 🙂 (https://
MrBBotM
MrBBot12/7/23, 9:22 AM
Working on it as we speak 🙂 (https://github.com/cloudflare/workers-sdk/tree/bcoll/vitest-pool-workers/packages/vitest-pool-workers) not quite ready for release yet but getting there. 🙂 Hoping to do an initial pre-release in the next few weeks, or early next year.
emoji1
The 2nd one doesn't seem to affect
oscarO
oscar11/30/23, 9:51 AM
The 2nd one doesn't seem to affect anything, but the first one seems correlated to these logs for failed requests happening in production
Screenshot_2023-11-30_at_10.50.40.png
got `nodejs compat` to work correctly
Original message was deleted
We have a new release now up on npm and
Original message was deleted
Next page
Worker
Worker
web-spawn
web-spawn
index.js
index.js
locationHint
locationHint
MongoDBConnection.js
MongoDBConnection.js
~30%
~30%
~2%
~2%
try{}catch{}
try{}catch{}
enableSql = true
enableSql = true
enableSql = true
enableSql = true
[[migrations]]
[[migrations]]
new_classes
new_classes
new_sqlite_classes
new_sqlite_classes
workerd
workerd
.mjs
.mjs
wrangler dev -e test --port 8787
wrangler dev -e test --port 8787
chrome://inspect
chrome://inspect
O2O
O2O
O2O
O2O
fetch(request)
fetch(request)
export { MongoDBConnection } from "./MongoDBConnection.js";

export default {
  async fetch(request, { MONGO_DB_CONNECTION, MONGO_DB_URI }) {
    // FWIW, you’ll probably want to do an auth check or similar here, to prevent wasting resources on fuzzing attacks
    // We can just forward the request straight onto the Durable Object
    const id = MONGO_DB_CONNECTION.idFromName(MONGO_DB_URI);
    const connection = MONGO_DB_CONNECTION.get(id, { locationHint: "apac" });
    return await connection.fetch(request);
  }
};
export { MongoDBConnection } from "./MongoDBConnection.js";

export default {
  async fetch(request, { MONGO_DB_CONNECTION, MONGO_DB_URI }) {
    // FWIW, you’ll probably want to do an auth check or similar here, to prevent wasting resources on fuzzing attacks
    // We can just forward the request straight onto the Durable Object
    const id = MONGO_DB_CONNECTION.idFromName(MONGO_DB_URI);
    const connection = MONGO_DB_CONNECTION.get(id, { locationHint: "apac" });
    return await connection.fetch(request);
  }
};
import { DurableObject } from "cloudflare:workers";
import mongoose from "mongoose";

export class MongoDBConnection extends DurableObject {
  connection;

  constructor(ctx, env) {
    super(ctx, env);
    this.connection = mongoose.createConnection(env.MONGO_DB_URI, {
      // Decrease the selection timeout from 30s (default) to 5s, so that if something breaks, we don't wait around for it.
      serverSelectionTimeoutMS: 5000,
    });
  }

  async fetch(request) {
    // Wait for the connection to become available
    await this.connection.asPromise();
    // Do work here
    return new Response("OK");
  }
}
import { DurableObject } from "cloudflare:workers";
import mongoose from "mongoose";

export class MongoDBConnection extends DurableObject {
  connection;

  constructor(ctx, env) {
    super(ctx, env);
    this.connection = mongoose.createConnection(env.MONGO_DB_URI, {
      // Decrease the selection timeout from 30s (default) to 5s, so that if something breaks, we don't wait around for it.
      serverSelectionTimeoutMS: 5000,
    });
  }

  async fetch(request) {
    // Wait for the connection to become available
    await this.connection.asPromise();
    // Do work here
    return new Response("OK");
  }
}