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
aroman
aromanβ€’10mo 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
chientrmβ€’10mo ago
that looks like js promise throw error cuz u didn't await nvm I'm not familiar with this. bye
aroman
aromanβ€’10mo ago
lol appreciate u
chientrm
chientrmβ€’10mo ago
me, too
aroman
aromanβ€’10mo 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
aroman
aromanβ€’10mo 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] ...
aroman
aromanβ€’10mo ago
i already had the wrangler version in the issue but i just added the bit about --remote, thanks
kian
kianβ€’10mo ago
Huh, I can't reproduce it personally
aroman
aromanβ€’10mo ago
what OS did you test it on?
kian
kianβ€’10mo ago
MacOS personally It looks like Kenton replied and was also unable to reproduce it
aroman
aromanβ€’10mo 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
More Posts