diff --git a/lib/plugins/aws/deploy/compile/functions/index.js b/lib/plugins/aws/deploy/compile/functions/index.js index 5afe77564..bbdaf3fce 100644 --- a/lib/plugins/aws/deploy/compile/functions/index.js +++ b/lib/plugins/aws/deploy/compile/functions/index.js @@ -29,8 +29,8 @@ class AwsCompileFunctions { throw new Error(`No artifact path is set for function: ${functionName}`); } - if (this.bucketName) { - newFunction.Properties.Code.S3Bucket = this.bucketName; + if (this.serverless.service.package.deploymentBucket) { + newFunction.Properties.Code.S3Bucket = this.serverless.service.package.deploymentBucket; } const s3Folder = this.serverless.service.package.artifactDirectoryName; diff --git a/lib/plugins/aws/deploy/compile/functions/tests/index.js b/lib/plugins/aws/deploy/compile/functions/tests/index.js index 5fd03291c..1f2ce8787 100644 --- a/lib/plugins/aws/deploy/compile/functions/tests/index.js +++ b/lib/plugins/aws/deploy/compile/functions/tests/index.js @@ -290,10 +290,9 @@ describe('AwsCompileFunctions', () => { it('should use a custom bucket if specified', () => { const bucketName = 'com.serverless.deploys'; - awsCompileFunctions.bucketName = bucketName; + awsCompileFunctions.serverless.service.package.deploymentBucket = bucketName; awsCompileFunctions.serverless.service.provider.runtime = 'python2.7'; awsCompileFunctions.serverless.service.provider.memorySize = 128; - awsCompileFunctions.serverless.service.provider.deploymentBucket = bucketName; awsCompileFunctions.serverless.service.functions = { func: { handler: 'func.function.handler', diff --git a/lib/plugins/aws/deploy/lib/configureStack.js b/lib/plugins/aws/deploy/lib/configureStack.js index 376a60e10..2c96df68c 100644 --- a/lib/plugins/aws/deploy/lib/configureStack.js +++ b/lib/plugins/aws/deploy/lib/configureStack.js @@ -94,6 +94,7 @@ module.exports = { ); } this.bucketName = bucketName; + this.serverless.service.package.deploymentBucket = bucketName; this.serverless.service.provider.compiledCloudFormationTemplate .Outputs.ServerlessDeploymentBucketName.Value = bucketName; diff --git a/lib/plugins/aws/deploy/lib/uploadArtifacts.js b/lib/plugins/aws/deploy/lib/uploadArtifacts.js index b88509bf6..5ce7bce69 100644 --- a/lib/plugins/aws/deploy/lib/uploadArtifacts.js +++ b/lib/plugins/aws/deploy/lib/uploadArtifacts.js @@ -16,6 +16,7 @@ module.exports = { Bucket: this.bucketName, Key: `${this.serverless.service.package.artifactDirectoryName}/${fileName}`, Body: body, + ContentType: 'application/json', }; return this.sdk.request('S3', @@ -38,6 +39,7 @@ module.exports = { Bucket: this.bucketName, Key: `${this.serverless.service.package.artifactDirectoryName}/${fileName}`, Body: body, + ContentType: 'application/zip', }; return this.sdk.request('S3',