ok this has to be a bug in `workerd`

ok, this has to be a bug in workerd. this works:
try {
const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), 1);
await fetch("https://example.com", {
signal: controller.signal
}
} catch {}
try {
const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), 1);
await fetch("https://example.com", {
signal: controller.signal
}
} catch {}
but not this:
try {
fetch("https://example.com", {
signal: AbortSignal.timeout(1)
}
} catch {}
try {
fetch("https://example.com", {
signal: AbortSignal.timeout(1)
}
} catch {}
I mean, both abort, but the former (correctly) suppresses the error, and the latter still throws a ✘ [ERROR] Uncaught (async) DOMException 😦
11 Replies
Avi
AviOP16mo ago
in case anyone searches discord in the future and finds this, i've reported this here: https://github.com/cloudflare/workerd/issues/1020
GitHub
🐛 Bug Report — Runtime APIs — AbortSignal.timeout throws un-catchab...
try { fetch("https://example.com", { signal: AbortSignal.timeout(1) } } catch {} expectation: when the promise is awaited, the fetch is aborted, and any error thrown is suppressed via the...
chientrm
chientrm16mo ago
that looks like js promise throw error cuz u didn't await nvm I'm not familiar with this. bye
Avi
AviOP16mo ago
lol appreciate u
chientrm
chientrm16mo ago
me, too
Avi
AviOP16mo ago
what? it is a bug oh, that's just an error in the repro code no, it won't updated the issue description correct; that's always been the issue. i just typed up that repro code quickly and missed the await glad you pointed that out though production as in --remote? no it does not, good thought will do! not the first time i've run into an issue like this yup, the very latest wrangler
Avi
AviOP16mo ago
i've also got this one where --remote fixes an issue, though this one is totally unrelated: https://github.com/cloudflare/miniflare/issues/651
GitHub
miniflare segfaults during startup on Ubuntu 22.04 (jammy) · Issue ...
npx wrangler dev --port $MC_SERVER_PORT --var MC_CONFIG_LOCAL_SUFFIX:$MC_CONFIG_LOCAL_SUFFIX LOG_LEVEL:$LOG_LEVEL GIT_SHA:$GIT_SHA [WebServer] ⛅️ wrangler 3.5.0 ------------------ [WebServer] ...
Avi
AviOP16mo ago
i already had the wrangler version in the issue but i just added the bit about --remote, thanks
kian
kian16mo ago
Huh, I can't reproduce it personally
Avi
AviOP16mo ago
what OS did you test it on?
kian
kian16mo ago
MacOS personally It looks like Kenton replied and was also unable to reproduce it
Avi
AviOP16mo ago
mind trying with my updated code? reliably reproduces for me with the new minimal sample code i provided ah, looks like another cloudflare engineer was able to reproduce it
Want results from more Discord servers?
Add your server