简体   繁体   中英

Attempting to connect to OVH Object storage using aws-sdk and receiving Error [TimeoutError]: socket hang up

I have the following code to attempt to connect to OVH Object storage and retrive the list of buckets I have

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

const s3 = new AWS.S3({
  accessKeyId: '930*****************************',
  secretAccessKey: 'b7c****************************',
  endPoint: 'https://storage.sbg.cloud.ovh.net',
  region: 'SBG',
});

s3.listBuckets((data) => {
  console.log('Buckets', data);
});

The error I'm receiving is uncomprehansible to me

Buckets Error [TimeoutError]: socket hang up
    at connResetException (https://node-nykybd.w-credentialless.staticblitz.com/blitz.79ba5d6ed4650f43d3d2f1721ce6e5bef04fff66.js:6:8256)
    at TLSSocket.socketOnEnd (https://node-nykybd.w-credentialless.staticblitz.com/blitz.79ba5d6ed4650f43d3d2f1721ce6e5bef04fff66.js:6:1086874)
    at EventEmitter.emit (https://node-nykybd.w-credentialless.staticblitz.com/blitz.79ba5d6ed4650f43d3d2f1721ce6e5bef04fff66.js:6:155690)
    at S.emit (https://node-nykybd.w-credentialless.staticblitz.com/blitz.79ba5d6ed4650f43d3d2f1721ce6e5bef04fff66.js:6:1408650)
    at endReadableNT (https://node-nykybd.w-credentialless.staticblitz.com/blitz.79ba5d6ed4650f43d3d2f1721ce6e5bef04fff66.js:6:660227)
    at _0x1811b5 (https://node-nykybd.w-credentialless.staticblitz.com/blitz.79ba5d6ed4650f43d3d2f1721ce6e5bef04fff66.js:15:148126)
    at https://node-nykybd.w-credentialless.staticblitz.com/blitz.79ba5d6ed4650f43d3d2f1721ce6e5bef04fff66.js:15:147876 {
  code: 'TimeoutError',
  time: 2022-11-19T14:04:13.643Z,
  region: 'SBG',
  hostname: 's3.sbg.amazonaws.com',
  retryable: true
}

Can anyone help debugging, any suggestion is welcome, thanks!

A few things here. However, I do not know how you run this code.

First, as it was already mentioned - check if you are able to retrieve the list of buckets from CLI.

Second - ensure you close sockets. AWS SDK is very sensitive about it:)

Third - SDK has a retry strategy, did you check the maxRetries?

Also, I heard that the order of module resolver is important.

I don't know what operating system you use, but in case of linux, you can check your sockets statistics using

ss -s and ss -a command.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM