You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Currently, testing how a Cloudflare Worker handles degraded infrastructure—like latency spikes in D1, eventual consistency delays in KV, or dropped connections to Durable Objects—requires polluting application code with custom failure-flag middleware. While this works in staging, it makes local development and CI testing cumbersome. We need a way to test how our frontend applications handle a hostile backend environment without modifying the pristine business logic of the Worker itself.
Describe the solution you'd like
I propose adding a native "Chaos Mode" directly into workerd (exposed via wrangler dev CLI flags or wrangler.toml). This would allow developers to artificially inject network latency, drop requests, or mock 500-level exceptions at the binding level.
Ideally, this could be configured globally or targeted at specific bindings:
Ini, TOML
# Proposed wrangler.toml configuration
[chaos]
latency_ms = [200, 2000] # Random latency injected between 200ms and 2serror_rate = 0.05# 5% of fetch/binding calls drop or return a 5xx error
[[chaos.bindings]]
type = "d1"latency_ms = 3000# Specifically throttle database queries to test timeouts
[[chaos.bindings]]
type = "durable_object"error_rate = 0.10# Simulate dropped websocket connections or mid-flight desyncs
Describe alternatives you've considered
Application-layer middleware: Wrapping fetch and database calls with custom logic. This pollutes the codebase, introduces overhead, and carries the risk of accidentally being deployed to production.
Forking workerd: Maintaining a custom C++ build of the runtime that intentionally fails. This provides the right sandboxed environment but is impossible to maintain across major Wrangler updates.
Additional context
This feature would unlock robust resilience testing in CI pipelines. Two critical use cases this solves:
Local-First Architecture: When engineering offline-capable web apps that synchronize native browser IndexedDB states to Durable Objects, having the local wrangler instance randomly drop connections is the only way to accurately test state reconciliation and sync recovery mechanisms locally.
Automated CI Sweeps: Running headless Puppeteer scripts against a local environment where workerd is intentionally degrading allows us to strictly monitor how frontend performance (like Core Web Vitals and Interaction to Next Paint metrics) handles backend stress.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Is your feature request related to a problem? Please describe.
Currently, testing how a Cloudflare Worker handles degraded infrastructure—like latency spikes in D1, eventual consistency delays in KV, or dropped connections to Durable Objects—requires polluting application code with custom failure-flag middleware. While this works in staging, it makes local development and CI testing cumbersome. We need a way to test how our frontend applications handle a hostile backend environment without modifying the pristine business logic of the Worker itself.
Describe the solution you'd like
I propose adding a native "Chaos Mode" directly into workerd (exposed via wrangler dev CLI flags or wrangler.toml). This would allow developers to artificially inject network latency, drop requests, or mock 500-level exceptions at the binding level.
Ideally, this could be configured globally or targeted at specific bindings:
Ini, TOML
Describe alternatives you've considered
Application-layer middleware: Wrapping fetch and database calls with custom logic. This pollutes the codebase, introduces overhead, and carries the risk of accidentally being deployed to production.
Forking workerd: Maintaining a custom C++ build of the runtime that intentionally fails. This provides the right sandboxed environment but is impossible to maintain across major Wrangler updates.
Additional context
This feature would unlock robust resilience testing in CI pipelines. Two critical use cases this solves:
Local-First Architecture: When engineering offline-capable web apps that synchronize native browser IndexedDB states to Durable Objects, having the local wrangler instance randomly drop connections is the only way to accurately test state reconciliation and sync recovery mechanisms locally.
Automated CI Sweeps: Running headless Puppeteer scripts against a local environment where workerd is intentionally degrading allows us to strictly monitor how frontend performance (like Core Web Vitals and Interaction to Next Paint metrics) handles backend stress.
All reactions