Context (ctx) · Cloudflare Workers docs
developers.cloudflare.com · 1,925 words · saved by 1 readers
The Context API in Cloudflare Workers, including props, exports, waitUntil and passThroughOnException.
The Context API provides methods to manage the lifecycle of your Worker or Durable Object. Context is exposed via the following places: As the third parameter in all handlers , including the fetch() handler . ( fetch(request, env, ctx) ) As a class property of the WorkerEntrypoint class ( this.ctx ) Note that the Context API is available strictly in stateless contexts, that is, not Durable Objects . However, Durable Objects have a different object, the Durable Object State , which is available as this.ctx inside a Durable Object class, and provides some of the same functionality as the Context
related reading
- Sandbox SDKsandbox.cloudflare.com
- Service worker overview | Workbox | Chrome for Developersdeveloper.chrome.com
- A service worker's life | Workbox | Chrome for Developersdeveloper.chrome.com
- Cloudflare Queues - JavaScript APIs · Cloudflare Queues docsdevelopers.cloudflare.com
- Introducing Model Context Protocol (MCP) | Glamaglama.ai
- Service Worker API - Web APIs | MDNdeveloper.mozilla.org
- Web Workers, comlink, TypeScript and React | johnnyreillyjohnnyreilly.com
- The service worker lifecycle | Articles | web.devweb.dev
- Cursor Docs — Agent, Rules, MCP, Skills & CLIdocs.cursor.com
- The subtle beauty of Durable Objects, and what could be better about them / Moment devlogmoment.dev
- DevDocs API Documentationdevdocs.io
- Web Workers API - Web APIs | MDNdeveloper.mozilla.org