feat(dns): added support for a custom lookup function; (#5339)#6
feat(dns): added support for a custom lookup function; (#5339)#6MitchLewis930 wants to merge 1 commit intopr_026_beforefrom
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| lookup: (hostname: string, opt: object) => { | ||
| return ['127.0.0.1', 4]; | ||
| } | ||
| }); |
There was a problem hiding this comment.
TypeScript async lookup test missing async keyword
Medium Severity
The "lookup async" TypeScript test is missing the async keyword. The function returns a plain array ['127.0.0.1', 4] instead of a Promise as required by the type definition Promise<[address: string, family: number] | string>. This causes a type mismatch and doesn't correctly validate the async lookup type signature. The runtime test at test/unit/adapters/http.js:2151 correctly uses async.
| } | ||
| return entry; | ||
| }) | ||
| } |
There was a problem hiding this comment.
Promise-returning lookup functions not detected unless using async
Low Severity
The type definition allows any function returning Promise<[address, family] | string>, but the implementation only detects functions declared with the async keyword via utils.isAsyncFn(). A regular function that returns a Promise (e.g., function lookup(h, o) { return Promise.resolve(['127.0.0.1', 4]); }) won't be wrapped by callbackify, causing the HTTP request to hang since the callback is never invoked.


PR_026
Note
Medium Risk
Touches the core Node HTTP adapter request option wiring (DNS resolution path), which could affect connectivity/redirect behavior, but is scoped and covered by new unit/typing tests.
Overview
Adds Node-only request config support for DNS control by passing
familyand a customlookupfunction through to the underlying Nodehttp(s).requestoptions.Async
lookupfunctions are now accepted by wrapping them into callback style via a newcallbackifyhelper, and typings + tests were updated to cover both callback and async lookup variants (including async returning just an IP string).Written by Cursor Bugbot for commit 2701911. This will update automatically on new commits. Configure here.