Skip to content

UnknownEndpoint exception not thrown with Node14 #3393

@workeitel

Description

@workeitel

Describe the bug

Node 14 changed the value of error.errno to be a numeric value: nodejs/node#28140

That impacts the translation of the UnknownEndpoint exception:

if (err.code === 'NetworkingError' && err.errno === 'ENOTFOUND') {

Is the issue in the browser/Node.js?
nodejs 14

If on Node.js, are you running this on AWS Lambda?

no

Details of the browser/Node.js version

$ node -v
v14.7.0

SDK version number
master branch HEAD

To Reproduce (observed behavior)

$ node14
> process.version
'v14.7.0'
> const AWS = require(".");
> ec2.describeInstances({}).promise().then(e => console.log(e), e => console.log(e));
> Error: getaddrinfo ENOTFOUND something.invalid
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:66:26)
    at GetAddrInfoReqWrap.callbackTrampoline (internal/async_hooks.js:129:14) {
  errno: -3008,
  code: 'NetworkingError',
  syscall: 'getaddrinfo',
  hostname: 'something.invalid',
  region: 'us-east-1',
  retryable: true,
  time: 2020-08-10T11:34:15.386Z
}
$ node12
> process.version
'v12.18.3'
> const AWS = require(".");
undefined
> const ec2 = new AWS.EC2({ region: "us-east-1", endpoint: "https://something.invalid" });
undefined
> ec2.describeInstances({}).promise().then(e => console.log(e), e => console.log(e));
Promise { <pending> }
> UnknownEndpoint: Inaccessible host: `something.invalid'. This service may not be available in the `us-east-1' region.
    at Request.ENOTFOUND_ERROR (/Volumes/unix/aws-sdk-js/lib/event_listeners.js:501:46)
    at Request.callListeners (/Volumes/unix/aws-sdk-js/lib/sequential_executor.js:106:20)
    at Request.emit (/Volumes/unix/aws-sdk-js/lib/sequential_executor.js:78:10)
    at Request.emit (/Volumes/unix/aws-sdk-js/lib/request.js:688:14)
    at ClientRequest.error (/Volumes/unix/aws-sdk-js/lib/event_listeners.js:339:22)
    at ClientRequest.<anonymous> (/Volumes/unix/aws-sdk-js/lib/http/node.js:96:19)
    at ClientRequest.emit (events.js:315:20)
    at ClientRequest.EventEmitter.emit (domain.js:483:12)
    at TLSSocket.socketErrorListener (_http_client.js:426:9)
    at TLSSocket.emit (events.js:315:20) {
  code: 'UnknownEndpoint',
  region: 'us-east-1',
  hostname: 'something.invalid',
  retryable: true,
  originalError: Error: getaddrinfo ENOTFOUND something.invalid
      at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:66:26)
      at GetAddrInfoReqWrap.callbackTrampoline (internal/async_hooks.js:120:14) {
    errno: 'ENOTFOUND',
    code: 'NetworkingError',
    syscall: 'getaddrinfo',
    hostname: 'something.invalid',
    region: 'us-east-1',
    retryable: true,
    time: 2020-08-10T11:35:54.953Z
  },
  time: 2020-08-10T11:35:54.953Z
}

Expected behavior
Node14 throws a UnknownEndpoint exception as well

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions