You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found undici built-in retry interceptor will only retry http error and ignore dns error. Is this a bug or feature?
Reproducible By
const{ interceptors, Client }=require('undici');const{ retry }=interceptors;(async()=>{constclient=newClient().compose(// httpbin/status/500 will return http status 500 so retry callback will trigger'https://httpbin.org',// x.y.z is a not reachable server will cause a ENOTFOUND error// but will not trigger retry callback// 'https://x.y.z',retry({retry: (err,{ state, opts },done)=>{console.log('#retry-callback triggered');},errorCodes: ['ENOTFOUND'],}),);constresponse=awaitclient.request({method: 'GET',path: '/status/500',headers: {'content-type': 'application/json',},});})();
undici version: 7.1.1
Expected Behavior
Retry callback log be triggered whether host is httpbin.org or x.y.z.
But actual behavior is only httpbin.org will trigger retry.
Logs & Screenshots
Environment
Node.js v22.11.0
Additional context
According to the retry-handler doc, retry handler has an option errorCodes means "Array of Error codes to retry", so retry dns error is expected in design?
Bug Description
I found undici built-in retry interceptor will only retry http error and ignore dns error. Is this a bug or feature?
Reproducible By
Expected Behavior
Retry callback log be triggered whether host is
httpbin.org
orx.y.z
.But actual behavior is only
httpbin.org
will trigger retry.Logs & Screenshots
Environment
Additional context
According to the retry-handler doc, retry handler has an option
errorCodes
means "Array of Error codes to retry", so retry dns error is expected in design?But in code, retry handler will skip retry in onResponseError hook when controller is falsy.
Controller was pass to onResponseError hook in onError hook,
but controller was only initialized at onConnect hook.
I guess there is no connection established when dns error, so onConnect will not be trigger, which leading controller is undefined.
The text was updated successfully, but these errors were encountered: