Changelog for https://github.com/cloudflare/workerd/pull/7053

Open Beginner friendly
#32,869 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Documentation
Clarity
Mostly clear
Activity status
Active
Tech stack
javascript
Domain
documentation

Research direction

Review the proposed changelog text and the referenced workerd pull request 7053 first, then search the documentation for warnings about AbortController, AbortSignal, EventTarget, and request-handler-only usage. Done means adding the changelog and updating any outdated guidance identified by that search.

Written by the indexing model from the issue text.

Description

content:new documentation product:workers
Proposed changes

here is a draft of a changelog for https://github.com/cloudflare/workerd/pull/7053

Create AbortSignals outside request handlers in the Workers runtime

You can now create AbortController and AbortSignal objects during module initialization in Cloudflare Workers:

const controller = new AbortController();
const alreadyCancelled = AbortSignal.abort("cancelled");

export default {
  async fetch() {
    return Response.json({
      cancelled: alreadyCancelled.aborted,
    });
  },
};

This change brings Workers in line with browsers and Node.js. Libraries can now create controllers, requests, and writable streams when you import them without encountering an IoContext error.

You can also observe or abort a signal from a different request running in the same isolate. Workerd routes cancellation to the request that owns each pending operation.

Do not use isolate-local signals when your application requires durable cancellation. Cloudflare may route requests to another isolate or restart an isolate at any time. Use a Durable Object to coordinate those requests.

AbortSignal.timeout() still requires an active request because it schedules a timer.

More consistent event handling

This change also aligns EventTarget behavior with the DOM standard:

  • One listener throwing an exception no longer prevents later listeners from running.
  • abort() no longer throws when an abort listener throws.
  • Workerd reports listener exceptions through the global error event and console.
  • Workerd removes listeners registered with { signal } before it runs abort listeners.
  • Events you construct report isTrusted === false.

Most applications require no changes.

Subject Matter

https://github.com/cloudflare/workerd/pull/7053

Content Location

new changelog. also research docs if there is anything we need to update, like warnings saying that you can't do what is now possible

Additional information

No response

Dominant language
MDX
Stars
5.2k
Forks
16.8k
Avg merge
2d 13h
Merged PRs (30d)
344

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cloudflare/cloudflare-docs

All issues in cloudflare/cloudflare-docs

Similar issues

More Documentation issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.