Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.3k
Closed
Description
I am on Node.js v12.6
I have this issue:
nodejs/help#2106
I think the error message is mis-named. The error message should be:
There was an error: TypeError [ERR_INVALID_OPT_VALUE]: The value "google.com" is invalid for option "address"
but the error message is:
There was an error: TypeError [ERR_INVALID_OPT_VALUE]: The value "google.com" is invalid for option "hostname"
this will work:
constdns=require('dns');constgetDNSInfo=(host)=>newPromise(resolve=>{dns.lookup(host,(err,hostname,service)=>{console.log('dns resolved:',{hostname, service, err});resolve({err, hostname, service});});});getDNSInfo('google.com').then(v=>{console.log(v);}).catch(v=>{console.error('There was an error:',v)});but this doesn't:
constdns=require('dns');constgetDNSInfo=(host,port)=>newPromise(resolve=>{dns.lookupService(host,port,(err,hostname,service)=>{console.log('dns resolved:',{hostname, service, err});resolve({err, hostname, service});});});getDNSInfo('google.com',80).then(v=>{console.log(v);}).catch(v=>{console.error('There was an error:',v)});Metadata
Metadata
Assignees
Labels
No labels