最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to make AWS S3 request retryable? - Stack Overflow

programmeradmin6浏览0评论

Sometimes when I download multiple files from S3 bucket using node sdk, the request will timeout for one of the downloads. I would like for the request to just retry to attempt to download again.

The json error response says retryable: false.

Is there a way I can configure it to be true?

Here is the error:

{ TimeoutError: Connection timed out after 480000ms
    at ClientRequest.<anonymous> (node_modules/aws-sdk/lib/http/node.js:83:34)
    at Object.onceWrapper (events.js:272:13)
    at ClientRequest.emit (events.js:180:13)
    at ClientRequest.emit (domain.js:421:20)
    at TLSSocket.emitTimeout (_http_client.js:703:34)
    at Object.onceWrapper (events.js:272:13)
    at TLSSocket.emit (events.js:180:13)
    at TLSSocket.emit (domain.js:421:20)
    at TLSSocket.Socket._onTimeout (net.js:396:8)
    at ontimeout (timers.js:466:11)
    at tryOnTimeout (timers.js:304:5)
    at Timer.listOnTimeout (timers.js:267:5)
  message: 'Connection timed out after 480000ms',
  code: 'TimeoutError',
  time: 2019-04-01T17:58:41.010Z,
  region: 'us-west-2',
  hostname: 'bucket-name',
  retryable: false,
  statusCode: 200,
  retryDelay: 129.76727762396757 }

Sometimes when I download multiple files from S3 bucket using node sdk, the request will timeout for one of the downloads. I would like for the request to just retry to attempt to download again.

The json error response says retryable: false.

Is there a way I can configure it to be true?

Here is the error:

{ TimeoutError: Connection timed out after 480000ms
    at ClientRequest.<anonymous> (node_modules/aws-sdk/lib/http/node.js:83:34)
    at Object.onceWrapper (events.js:272:13)
    at ClientRequest.emit (events.js:180:13)
    at ClientRequest.emit (domain.js:421:20)
    at TLSSocket.emitTimeout (_http_client.js:703:34)
    at Object.onceWrapper (events.js:272:13)
    at TLSSocket.emit (events.js:180:13)
    at TLSSocket.emit (domain.js:421:20)
    at TLSSocket.Socket._onTimeout (net.js:396:8)
    at ontimeout (timers.js:466:11)
    at tryOnTimeout (timers.js:304:5)
    at Timer.listOnTimeout (timers.js:267:5)
  message: 'Connection timed out after 480000ms',
  code: 'TimeoutError',
  time: 2019-04-01T17:58:41.010Z,
  region: 'us-west-2',
  hostname: 'bucket-name',
  retryable: false,
  statusCode: 200,
  retryDelay: 129.76727762396757 }
Share edited Apr 1, 2019 at 18:21 Nicholas Porter asked Apr 1, 2019 at 18:14 Nicholas PorterNicholas Porter 3,0014 gold badges24 silver badges40 bronze badges 1
  • can you share your code ? – Atul Kumar Commented Apr 11, 2019 at 4:21
Add a ment  | 

1 Answer 1

Reset to default 4

I am not sure of how you are using the resources as you didn't share your code, but this might help you.

// setting retries
var s3 = new AWS.S3({apiVersion: '2006-03-01', maxRetries:10}); 

S3 sdk documentation - maxRetries

发布评论

评论列表(0)

  1. 暂无评论