Skip to content

Instantly share code, notes, and snippets.

@firsovsenya
Created May 28, 2026 08:32
Show Gist options
  • Select an option

  • Save firsovsenya/96d71ef7d8fcd970df3fd24a8905705e to your computer and use it in GitHub Desktop.

Select an option

Save firsovsenya/96d71ef7d8fcd970df3fd24a8905705e to your computer and use it in GitHub Desktop.

Ran into some weird behavior with AbortController in Safari 17.

Pretty basic fetch with a timeout:

const controller = new AbortController();

setTimeout(() => controller.abort(), 3000);

try {
  const res = await fetch(url, {
    signal: controller.signal
  });
} catch (e) {
  console.log(e.name);
}

In Chrome and Firefox I consistently get AbortError, but in Safari the request sometimes just keeps hanging, especially when the server keeps the connection alive for a while.

Anyone else seen this?

Is this a Safari bug or am I missing something with signals/cleanup?

Mainly interested in behavior on macOS Sonoma + Safari 17.x.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment