serverless-s3-sync icon indicating copy to clipboard operation
serverless-s3-sync copied to clipboard

sync wont work

Open gitgoose opened this issue 6 years ago • 12 comments

sls s3sync command does not seem to work for me..Help appreciated!!

sls version 1.26.1 python 3.6 "serverless-s3-sync": "^1.4.0"

Config : custom: pythonRequirements: dockerizePip: true defaultStage: dev currentStage: ${opt:stage, self:custom.defaultStage} s3Sync: - bucketName: ${file(configs/config.${self:custom.currentStage}.json):syncBucketName} localDir: required-artifacts/${self:custom.currentStage} # required sse: AES256

Error: $ sls s3sync S3 Sync: Syncing directories and S3 prefixes... ~/node_modules/aws-sdk/lib/request.js:31 throw err; ^

Error: connect ECONNREFUSED 52.216.226.48:443

I am operating behind a corp proxy and have the proxy settings exported in env variables also have

HTTPS_PROXY=<> HTTP_PROXY=<> NPM_CONFIG_PROXY=<>

gitgoose avatar Apr 18 '18 11:04 gitgoose

I would actually label this as "Help wanted" because it not a bug. This should help you: https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/node-configuring-proxies.html.

alexandrusavin avatar Apr 20 '18 12:04 alexandrusavin

@alexandrusavin Thank you!

k1LoW avatar Apr 21 '18 07:04 k1LoW

@alexandrusavin @k1LoW You suggesting to edit the module to include this.If so where? I thought it should pick it from env vavriables. Also i am using a serverless python project. I believe its a bug

gitgoose avatar Apr 24 '18 13:04 gitgoose

@gitgoose you are right, this is a bug. The problem is that serverless-s3-sync plugin is not using the aws sdk provided by serverless api. Ex:

this.provider = this.serverless.getProvider('aws')
const s3 = new this.provider.sdk.S3({
      region: this.options.region
    })

This will then make sure to consider the HTTP_PROXY env variable (see here: https://github.com/serverless/serverless/blob/master/lib/plugins/aws/provider/awsProvider.js#L132).

@k1LoW I would change the lable of this issue back to bug

Also, see this as a reference for implementation

alexandrusavin avatar Apr 25 '18 10:04 alexandrusavin

this.provider = this.serverless.getProvider('aws')
const s3 = new this.provider.sdk.S3({
      region: this.options.region
    })

only works with the default profile, it doesn't use region/key/secret from the profile associated in the YML.

GuidoS avatar Apr 25 '18 17:04 GuidoS

@GuidoS @k1LoW I’m preparing a PR. Should be ready in a couple of hours.

alexandrusavin avatar Apr 25 '18 18:04 alexandrusavin

Here it is actually https://github.com/k1LoW/serverless-s3-sync/pull/12

alexandrusavin avatar Apr 25 '18 18:04 alexandrusavin

I think I found another issue that makes it look like it's not working in #13

GuidoS avatar Apr 25 '18 20:04 GuidoS

@alexandrusavin @GuidoS It still does not seem to work for me beind proxy node_modules/@monolambda/s3/node_modules/aws-sdk/lib/request.js:31 throw err; ^

Error: connect ETIMEDOUT 52.216.161.147:443 at Object._errnoException (util.js:1022:11) at _exceptionWithHostPort (util.js:1044:20) at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1198:14)

gitgoose avatar May 01 '18 00:05 gitgoose

@gitgoose can you share the configuration? It should work if you set HTTPS_PROXY.

alexandrusavin avatar May 01 '18 07:05 alexandrusavin

@k1LoW can you please check this PR https://github.com/k1LoW/serverless-s3-sync/pull/16? It might be related to @gitgoose 's problem.

alexandrusavin avatar May 14 '18 08:05 alexandrusavin

@alexandrusavin Thank you for your mention !!

k1LoW avatar May 15 '18 11:05 k1LoW