-
-
Notifications
You must be signed in to change notification settings - Fork 668
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Bug Description
When using RetryAgent, Node exits while there are pending retries in flight.
Reproducible By
I've been playing around in a brand new node project with only unidici
installed and trying to run the following script. This is mostly copy/pasted from the docs - I don't think I'm doing anything unorthodox here.
import { request, Agent, RetryAgent } from "undici";
const resp = await request("http://httpbin.org/status/418", {
dispatcher: new RetryAgent(new Agent(), {
statusCodes: [418],
}),
headers: { "User-Agent": "teapot" },
});
console.log("status:", resp.statusCode);
console.log("headers:", resp.headers);
Expected Behavior
I'd expect to get either an HTTP response or a retry error.
Logs & Screenshots
$ node example.js; echo "exit code: $status"
Warning: Detected unsettled top-level await at file:///[redacted]/example.js:3
const resp = await request("http://httpbin.org/status/418", {
^
exit code: 13
Additional context
$ node --version
v23.5.0
$ grep undici package.json
"undici": "^7.2.0"
mcollina and od0
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working