Skip to content

Commit

Permalink
fix bug where S3 client would not get instantiated with offline options
Browse files Browse the repository at this point in the history
  • Loading branch information
rcambrj authored and k1LoW committed Oct 26, 2021
1 parent df31b4e commit 34fea8c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ custom:
# ...
```

run `sls offline start --profile s3local` to sync to the local s3 bucket instead of Amazon AWS S3
As per [serverless-s3-local's instructions](https://github.com/ar90n/serverless-s3-local#triggering-aws-events-offline), once a local credentials profile is configured, run `sls offline start --aws-profile s3local` to sync to the local s3 bucket instead of Amazon AWS S3

> `bucketNameKey` will not work in offline mode and can only be used in conjunction with valid AWS credentials, use `bucketName` instead.

run `sls deploy` for normal deployment
5 changes: 1 addition & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,7 @@ class ServerlessS3Sync {
s3Options.endpoint = new provider.sdk.Endpoint(this.serverless.service.custom.s3Sync.endpoint);
s3Options.s3ForcePathStyle = true;
}
const s3Client = new provider.sdk.S3({
region: region,
credentials: awsCredentials
});
const s3Client = new provider.sdk.S3(s3Options);
if(this.getEndpoint() && this.isOffline()) {
//see: https://github.com/aws/aws-sdk-js/issues/1157
s3Client.shouldDisableBodySigning = () => true
Expand Down

0 comments on commit 34fea8c

Please sign in to comment.