Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option for SSL #48

Open
saadqc opened this issue Jul 17, 2017 · 4 comments
Open

Add option for SSL #48

saadqc opened this issue Jul 17, 2017 · 4 comments

Comments

@saadqc
Copy link

saadqc commented Jul 17, 2017

I am trying to upload static files to S3. It works with node 4.10 but throws following error with 8.1.2

here is the task

var s3 = require('gulp-s3-upload')(config.aws_credentials);

gulp.task("upload", function () {
  log('Syncing files with s3 bucket');
  gulp.src(config.build + '**/*')
    .pipe(s3({
      Bucket: config.bucket, //  Required
      ACL: 'public-read',       //  Needs to be user-defined,
      keyTransform: function (relative_filename) {
        var new_name = 'build/' + relative_filename;
        log(new_name);
        // or do whatever you want
        return new_name;
      }
    }, {
      // S3 Constructor Options, ie:
      maxRetries: 5
    }));
});

I am sure that I have access to S3. As I can update files with node 4.1.0 version. The issue with SSL.
Can we simply put an option to use SSL or not? like in aws sdk we can use sslEnabled: false

[14:26:00] build/images/img/default/fancybox/fancybox_overlay.png
[14:26:00] build/images/img/default/fancybox/fancybox_sprite.png
/home/saad/PycharmProjects/sample/web-app/node_modules/aws-sdk/lib/request.js:31
            throw err;
            ^

Error: S3 headObject Error: Error: Hostname/IP doesn't match certificate's altnames: "Host: sample2017-staging.s3.amazonaws.com. is not in the cert's altnames: DNS:*.s3.amazonaws.com, DNS:s3.amazonaws.com"
    at Object.checkServerIdentity (tls.js:221:17)
    at TLSSocket.<anonymous> (_tls_wrap.js:1104:29)
    at emitNone (events.js:105:13)
    at TLSSocket.emit (events.js:207:7)
    at TLSSocket._finishInit (_tls_wrap.js:628:8)
    at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:458:38)
    at Request.callListeners (/home/saad/PycharmProjects/sample/web-app/node_modules/aws-sdk/lib/sequential_executor.js:107:43)
    at Request.emit (/home/saad/PycharmProjects/sample/web-app/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
    at Request.emit (/home/saad/PycharmProjects/sample/web-app/node_modules/aws-sdk/lib/request.js:668:14)
    at Request.transition (/home/saad/PycharmProjects/sample/web-app/node_modules/aws-sdk/lib/request.js:22:10)
    at AcceptorStateMachine.runTo (/home/saad/PycharmProjects/sample/web-app/node_modules/aws-sdk/lib/state_machine.js:14:12)
    at /home/saad/PycharmProjects/sample/web-app/node_modules/aws-sdk/lib/state_machine.js:26:10
    at Request.<anonymous> (/home/saad/PycharmProjects/sample/web-app/node_modules/aws-sdk/lib/request.js:38:9)
    at Request.<anonymous> (/home/saad/PycharmProjects/sample/web-app/node_modules/aws-sdk/lib/request.js:670:12)
    at Request.callListeners (/home/saad/PycharmProjects/sample/web-app/node_modules/aws-sdk/lib/sequential_executor.js:115:18)
    at Request.emit (/home/saad/PycharmProjects/sample/web-app/node_modules/aws-sdk/lib/sequential_executor.js:77:10)

@clineamb
Copy link
Owner

I'll take a look into this. I have somewhat dropped the ball and haven't made an update to the versions of this. Expect an update soon.

@saadqc
Copy link
Author

saadqc commented Jul 19, 2017

Awesome! Thank You.

@clineamb
Copy link
Owner

@saadqc - Can you post the structure of your config.awscredentials?

By default, the initial constructor takes in SSLEnabled as per the AWS SDK:
http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html

So:

var s3      = require('gulp-s3-upload')({
    'accessKeyId': 'YOURACCESSKEYID',
    'secretAccessKey': 'YOURSECRET',
    'sslEnabled': true,
    /* any other necessary options to enable SSL */
});

@saadqc
Copy link
Author

saadqc commented Jul 23, 2017

Here is the structure:

var aws_credentials= {
'accessKeyId': 'YOURACCESSKEYID',
'secretAccessKey': 'YOURSECRET'
};

Regarding sslEnabled option. Yes, I set that to false/true but that didn't work in my case.

Also, few things that I tried to get it working but no luck with that too.
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
https://stackoverflow.com/a/21961005/2490859

Did you try on Node >= 8.0 version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants