-
-
Notifications
You must be signed in to change notification settings - Fork 960
Options freezing breaks abort signal #2099
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Note that it can even break when not calling import got from 'got';
const abortCtrl = new AbortController();
const got2 = got.extend({
signal: abortCtrl.signal,
});
for (let i = 0; i < 50; i++) {
abortCtrl.signal.addEventListener('abort', () => { /* noop */ });
} $ node test2.mjs
node:internal/event_target:423
this[kMaxEventTargetListenersWarned] = true;
^
TypeError: Cannot assign to read only property 'Symbol(events.maxEventTargetListenersWarned)' of object '#<AbortSignal>'
at AbortSignal.[kNewListener] (node:internal/event_target:423:44)
at AbortSignal.[kNewListener] (node:internal/abort_controller:173:24)
at AbortSignal.addEventListener (node:internal/event_target:535:23)
at file:///tmp/test2.mjs:8:22
at ModuleJob.run (node:internal/modules/esm/module_job:198:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:385:24)
at async loadESM (node:internal/process/esm_loader:88:5)
at async handleMainPromise (node:internal/modules/run_main:61:12) I suspect there might be other cases as well. |
svvac
added a commit
to svvac/got
that referenced
this issue
Aug 4, 2022
svvac
added a commit
to svvac/got
that referenced
this issue
Aug 4, 2022
svvac
added a commit
to svvac/got
that referenced
this issue
Aug 4, 2022
svvac
added a commit
to svvac/got
that referenced
this issue
Aug 4, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
Options
objects freeze the abort signal if it gets passed. As a result setting thesignal
prop ends up breaking the signal under node as the builtin code sets private properties when callingAbortController.abort()
.This makes it impossible to pass a default abort signal to a
Got
instance as the runtime will throw when aborting.v16.15.1
v12.3.0
The text was updated successfully, but these errors were encountered: