Skip to content

Parallel DNS lookups sometimes fail #4783

Answered by dylanlan
dylanlan asked this question in Q&A
Discussion options

You must be logged in to vote

My goal is to find a suitable workaround for the specific package dependencies that I'm using. In this case, various @aws-sdk packages (eg: @aws-sdk/client-ssm).

Since it's a nested dependency package that is doing the DNS lookup, I cannot easily change it to use dns.resolve(), nor directly configure it to use {family:4}

My best workaround so far is to try and patch the dns.lookup method to always set family:4, but I'm not sure if this can cause other issues.

eg: something like this near process start:

const dns = require('node:dns');
const originalLookup = dns.lookup;

dns.lookup = function (domain, options, callback) {
    // Check if options are provided
    if (typeof options === 'fun…

Replies: 0 comments 6 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@dylanlan
Comment options

Answer selected by dylanlan
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
5 participants