Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

204
Views
AWS SDK maxRetries doesn't work in Nodejs

I made a code using aws sdk as below.

var winston = require('winston'),
    WinstonCloudWatch = require('winston-cloudwatch');
const express = require('express')
const app = express()

const AWS = require('aws-sdk');

AWS.config.update({
    maxRetries: 2, region: 'us-northeast-2', accessKeyId: "", secretAccessKey: ""
});

winston.add(new WinstonCloudWatch({
    cloudWatchLogs: new AWS.CloudWatchLogs(),
    logGroupName: 'testing',
    logStreamName: 'first'
}));

app.listen(3000, () => {
    winston.error('1');
    console.log('bound')
})

This is really simple code.
But the thing is I want to retry this only two times when it fails in various situations.
In this case, it can't accessed without accessKey and secretAccessKey.
Therefore, it is obvious, it can't be accessed.
It gives this error in the console.

UnknownEndpoint: Inaccessible host: logs.us-northeast-2.amazonaws.com' at port undefined'. This service may not be available in the `us-northeast-2' region. at Request.ENOTFOUND_ERROR (C:\Users\dd\Desktop\abc\node_modules\aws-sdk\lib\event_listeners.js:529:46) at Request.callListeners (C:\Users\dd\Desktop\abc\node_modules\aws-sdk\lib\sequential_executor.js:106:20) at Request.emit (C:\Users\dd\Desktop\abc\node_modules\aws-sdk\lib\sequential_executor.js:78:10) at Request.emit (C:\Users\dd\Desktop\abc\node_modules\aws-sdk\lib\request.js:686:14) at error (C:\Users\dd\Desktop\abc\node_modules\aws-sdk\lib\event_listeners.js:361:22) at ClientRequest. (C:\Users\dd\Desktop\abc\node_modules\aws-sdk\lib\http\node.js:99:9) at ClientRequest.emit (events.js:315:20) at ClientRequest.EventEmitter.emit (domain.js:486:12) at TLSSocket.socketErrorListener (_http_client.js:469:9) at TLSSocket.emit (events.js:315:20) { code: 'UnknownEndpoint', region: 'us-northeast-2', hostname: 'logs.us-northeast-2.amazonaws.com', retryable: true,
originalError: Error: getaddrinfo EAI_AGAIN logs.us-northeast-2.amazonaws.com at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:67:26) { errno: -3001, code: 'NetworkingError', syscall: 'getaddrinfo', hostname: 'logs.us-northeast-2.amazonaws.com', region: 'us-northeast-2', retryable: true, time: 2021-11-27T13:50:14.938Z }, time: 2021-11-27T13:50:14.938Z }

But I set an option as maxRetries:2 in aws config.
Nevertheless, it retries infinitely.
Could I retry only two times in this case?
Thank you for reading my question.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!