Search code examples
amazon-s3cloud-foundryconnectivityswisscomdev

Connectivity issues "ECONNRESET" with dynamic storage s3 and node.js


I'm following the step-by-step tutorial for dynamic storage dynstrg.

I have created an app, linked it with the service dynstrg and created a bucket with dragondisk as described.

When I call the app on the browser I get the following error:

{
message: "read ECONNRESET",
code: "NetworkingError",
errno: "ECONNRESET",
syscall: "read",
region: "eu-west-1",
hostname: "denistestbucket.ds31s3.swisscom.com",
retryable: true,
time: "2016-06-16T10:15:42.670Z"
}

My manifest.yml looks as follows:

---
services:
 - denisteststorage
applications:
- name: denistestapp
  memory: 128MB
  instances: 1
  domain: scapp-corp.swisscom.com
  command: node app.js
  env:
     bucketName: denistestbucket

Is there an issue with the storage? Or can anyone tell me what I am doing wrong? (I also tried to connect with boto3 directly to the storage, with the error "connection aborted").


Solution

  • I found the problem and it appears to be related to the version of the module "aws-sdk" used. Following the tutorial, the version used is "aws-sdk": "^2.2.9" this automatically causes the download of the latest aws-sdk version, the 2.4.0 version. This version causes the error you observed because by default it uses the signature version 4. To access the Dynamic Storage S3 (based on EMC ATMOS. The documentation can be found here) it is necessary to use the signature version 2. You can do this by changing this line on the file "app.js":

    var s3Client = new AWS.S3({endpoint: endpoint});
    

    with this line:

    var s3Client = new AWS.S3({endpoint: endpoint, signatureVersion: 'v2'});
    

    This should solve the issue. In addition, I also fixed the tutorial.