cloudflare / cloudflare/cloudflare-docs

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

Open Beginner friendly
#32,869 6 comments 0 reactions 0 assignees View on GitHub
content:new documentation product:workers
Dominant language
MDX
Stars
5.2k
Forks
16.7k
Avg merge
2d 6h
Merged PRs (30d)
337

Description

### 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:

```js
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_

Contributor guide

Open the contributing guide

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.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.