We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
On getting status code >= 400 from serever, retry handler throws an error which closes the open connection
you will see here
New connection connection closed New connection Hello World
const fastify = require("fastify"); const { RetryAgent, Agent } = require("undici"); const app = fastify(); let tries = 0; app.get("/", (req, res) => { if (++tries % 2 !== 0) { return res.status(500).send("Test error"); } res.send("Hello World"); }); app.server.on("connection", (socket) => { console.log("New connection"); socket.on("close", () => { console.log("connection closed"); }); }); async function start() { await app.listen({ port: 3000 }); const a = new RetryAgent(new Agent({ connections: 1 })); const res = await a.request({ origin: "http://localhost:3000", path: "/", method: "GET", }); console.log(await res.body.text()); } start();
It will pass the error but will leave the connection open if its non-connection related error
By destroying the socket it also prevents the user get the error body from response
The text was updated successfully, but these errors were encountered:
Thanks for reporting! Would you like to send a Pull Request to address this issue? Remember to add unit tests.
Sorry, something went wrong.
I prepared some code, hopefully it is the correct fix, will send the PR soon
Successfully merging a pull request may close this issue.
Bug Description
On getting status code >= 400 from serever, retry handler throws an error which closes the open connection
Reproducible By
you will see here
Expected Behavior
It will pass the error but will leave the connection open if its non-connection related error
Additional context
By destroying the socket it also prevents the user get the error body from response
The text was updated successfully, but these errors were encountered: