I've been using the axios-retry module and I've noticed an inconsistent behavior with the isNetworkOrIdempotentRequestError function. It seems that sometimes the same error is handled by this function, and sometimes it's not.
This inconsistency is causing some issues in my application as I rely on this function to handle certain network or idempotent request errors. I'm not sure if this is a bug or if I'm missing something in my implementation.
For reference, Here is the relevant code snippet:
// Server
const fastify = require('fastify')({
logger: true,
});
fastify.get('/', function () {
const isHealthy = Math.random() > 0.5;
if (!isHealthy) {
throw new Error();
}
return { hello: 'world' };
});
fastify.post('/', function () {
const isHealthy = Math.random() > 0.5;
if (!isHealthy) {
throw new Error();
}
return { hello: 'world' };
});
fastify.listen({ port: 3000 }, function (err) {
if (err) {
fastify.log.error(err);
process.exit(1);
}
});
Sometimes the output is Condition Result: false and sometimes Condition Result: true
Could you please provide some guidance on how this function is supposed to work? Any help would be greatly appreciated.
Hello,
I've been using the
axios-retry
module and I've noticed an inconsistent behavior with theisNetworkOrIdempotentRequestError
function. It seems that sometimes the same error is handled by this function, and sometimes it's not.This inconsistency is causing some issues in my application as I rely on this function to handle certain network or idempotent request errors. I'm not sure if this is a bug or if I'm missing something in my implementation.
For reference, Here is the relevant code snippet:
The most important log to pay attention to is
Sometimes the output is
Condition Result: false
and sometimesCondition Result: true
Could you please provide some guidance on how this function is supposed to work? Any help would be greatly appreciated.Thank you