mirror of
https://github.com/serverless/serverless.git
synced 2026-01-25 15:07:39 +00:00
Fix issue using this.bucketName, but the bucket on the service package instead.
Also added the content-type to the json file so you can read the file in the browser.
This commit is contained in:
parent
83dfb88302
commit
b97c7176d5
@ -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;
|
||||
|
||||
@ -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',
|
||||
|
||||
@ -94,6 +94,7 @@ module.exports = {
|
||||
);
|
||||
}
|
||||
this.bucketName = bucketName;
|
||||
this.serverless.service.package.deploymentBucket = bucketName;
|
||||
this.serverless.service.provider.compiledCloudFormationTemplate
|
||||
.Outputs.ServerlessDeploymentBucketName.Value = bucketName;
|
||||
|
||||
|
||||
@ -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',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user