Skip to content

Chaos Types

Chaos Maker applies browser-side chaos to APIs your frontend already uses.

TypeConfig keyEffect
Failurenetwork.failuresReturns a configured HTTP status and body.
Latencynetwork.latenciesDelays matched requests by delayMs.
Abortnetwork.abortsAborts immediately or after timeout.
Corruptionnetwork.corruptionsRewrites response text with truncate, malformed-json, empty, or wrong-type.
CORSnetwork.corsSimulates a browser network/CORS failure.

Network rules match by urlPattern substring and optional methods.

GraphQL operations can be matched inside the same network rules with graphqlOperation.

network: {
failures: [{
urlPattern: '/graphql',
graphqlOperation: 'GetUser',
statusCode: 503,
probability: 1,
}],
}

ui.assaults targets DOM nodes by CSS selector and applies disable, hide, or remove.

ui: {
assaults: [{ selector: 'button[type="submit"]', action: 'disable', probability: 0.5 }],
}
TypeConfig keyEffect
Dropwebsocket.dropsDrops inbound, outbound, or both directions.
Delaywebsocket.delaysDelays matched messages.
Corruptwebsocket.corruptionsRewrites text/binary payloads where supported.
Closewebsocket.closesCloses a matched socket with code, reason, and optional delay.

All probability-driven decisions use the seeded PRNG.

Service Worker chaos applies the same network rules inside self.fetch. Add the SW bundle to the worker, then send config from your adapter with injectSWChaos.

// classic sw.js
importScripts('/chaos-maker-sw.js');

See Service Worker Chaos for adapter-specific setup and limitations.

TypeConfig keyEffect
Dropsse.dropsSkips inbound EventSource events.
Delaysse.delaysDelays inbound events by delayMs.
Corruptsse.corruptionsRewrites event.data.
Closesse.closesCloses the EventSource after optional afterMs.

SSE rules match by urlPattern; drop, delay, and corruption rules can also target eventType.