0

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!

Meddah Abdallah
  • 654
  • 1
  • 7
  • 25
  • See: https://stackoverflow.com/questions/16995184/nodejs-what-does-socket-hang-up-actually-mean – Parzh from Ukraine Nov 21 '22 at 15:38
  • The error `socket hang up` seems to be generic, I don't see the link between my problem and the stackoverflow you send – Meddah Abdallah Nov 21 '22 at 23:59
  • Can you run this from your local machine directly? Can you also use the AWS cli to access the buckets, e.g. `awe s3 ls` (with your OVH endpoint url) – dangarfield Nov 24 '22 at 06:21
  • In your error, the `s3.sbg.amazonaws.com` looks strange: "SBG" is an OVH datacenter, so that's strange to see it in an `amazonaws.com` URL. The `https://storage.sbg.cloud.ovh.net` is the good URL. Are you sure of your config ? – Pierre Jan 06 '23 at 11:34

1 Answers1

0

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.

Pawel Piwosz
  • 111
  • 4