ENF News Bot
Automated News Bot
- Joined
- Apr 15, 2022
- Messages
- 2,591
Starting November 17, 2026, Workers with a compatibility date of
We introduced this feature in May 2025. You can log cancellations, clean up resources, or cancel operations that accept an
For example, this Worker logs a client disconnection and cancels an outgoing request:
src/index.jsjs
src/index.tsts
Existing Workers keep their current behavior until you change their compatibility date or flags. To try this feature before November 17, keep your current date and add
With a compatibility date of
For more information, refer to the Request API and the Request.signal compatibility flag.
Continue reading...
2026-11-17 or later will receive client disconnection events through request.signal by default. Use these events to stop unnecessary work when a client leaves. You will no longer need the enable_request_signal compatibility flag for these dates.We introduced this feature in May 2025. You can log cancellations, clean up resources, or cancel operations that accept an
AbortSignal.For example, this Worker logs a client disconnection and cancels an outgoing request:
src/index.jsjs
Code:
export default {
async fetch(request) {
request.signal.addEventListener(
"abort",
() => {
console.log("Client disconnected");
},
{ once: true },
);
return fetch("https://example.com/slow-response", {
signal: request.signal,
});
},
};
Code:
export default {
async fetch(request): Promise<Response> {
request.signal.addEventListener(
"abort",
() => {
console.log("Client disconnected");
},
{ once: true },
);
return fetch("https://example.com/slow-response", {
signal: request.signal,
});
},
} satisfies ExportedHandler;
Existing Workers keep their current behavior until you change their compatibility date or flags. To try this feature before November 17, keep your current date and add
enable_request_signal to your compatibility flags.With a compatibility date of
2026-11-17 or later, add disable_request_signal to opt out. This change does not enable request_signal_passthrough. Pass the signal explicitly, as the example does.For more information, refer to the Request API and the Request.signal compatibility flag.
Continue reading...