Skip to content

Commit

Permalink
Update to version v5.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
@tomnight committed Nov 19, 2020
1 parent 2c0327c commit 6a98ad9
Show file tree
Hide file tree
Showing 35 changed files with 4,318 additions and 2,671 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

**Checklist**
- [ ] :wave: I have run the unit tests, and all unit tests have passed.
- [ ] :warning: This pull request migh incur a breaking change.
- [ ] :warning: This pull request might incur a breaking change.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
32 changes: 31 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,37 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [5.0] - 2020-08-31
## [5.1.0] - 2020-11-19
### ⚠ BREAKING CHANGES
- **Image URL Signature**: When image URL signature is enabled, all URLs including existing URLs should have `signature` query parameter.

### Added
- Image URL signature: [#111](https://github.com/awslabs/serverless-image-handler/issues/111), [#203](https://github.com/awslabs/serverless-image-handler/issues/203), [#221](https://github.com/awslabs/serverless-image-handler/issues/221), [#227](https://github.com/awslabs/serverless-image-handler/pull/227)
- AWS Lambda `413` error handling. When the response payload is bigger than 6MB, it throws `TooLargeImageException`: [#35](https://github.com/awslabs/serverless-image-handler/issues/35), [#97](https://github.com/awslabs/serverless-image-handler/issues/97), [#193](https://github.com/awslabs/serverless-image-handler/issues/193), [#204](https://github.com/awslabs/serverless-image-handler/issues/204)
- Default fallback image: [#137](https://github.com/awslabs/serverless-image-handler/issues/137)
- Unit tests for custom resource: `100%` coverage
- Add `SVG` support. When any edits are used, the output would be automatically `PNG` unless the output format is specified: [#31](https://github.com/awslabs/serverless-image-handler/issues/31), [#234](https://github.com/awslabs/serverless-image-handler/issues/234)
- Custom headers: [#182](https://github.com/awslabs/serverless-image-handler/pull/182)
- Enabling ALB Support : [#201](https://github.com/awslabs/serverless-image-handler/pull/201)

### Fixed
- Thumbor paths broken if they include "-" and "100x100": [#208](https://github.com/awslabs/serverless-image-handler/issues/208)
- Rewrite doesn't seem to be working: [#121](https://github.com/awslabs/serverless-image-handler/issues/121)
- Correct EXIF: [#197](https://github.com/awslabs/serverless-image-handler/issues/197), [#220](https://github.com/awslabs/serverless-image-handler/issues/220), [#235](https://github.com/awslabs/serverless-image-handler/issues/235), [#236](https://github.com/awslabs/serverless-image-handler/issues/236), [#240](https://github.com/awslabs/serverless-image-handler/issues/240)
- Sub folder support in Thumbor `watermark` filter: [#231](https://github.com/awslabs/serverless-image-handler/issues/231)

### Changed
- AWS CDK and AWS Solutions Constructs version (from 1.57.0 to 1.64.1)
- sharp base version (from 0.25.4 to 0.26.1)
- Refactors the custom resource Lambda source code
- Migrate unit tests to use `jest`
- Move all `aws-sdk` in `ImageHandler` Labmda function to `index.js` for the best practice
- Enhance the default error message not to show empty JSON: [#206](https://github.com/awslabs/serverless-image-handler/issues/206)

### Removed
- Remove `manifest-generator`

## [5.0.0] - 2020-08-31
### Added
- AWS CDK and AWS Solutions Constructs to create AWS CloudFormation template

Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
22 changes: 8 additions & 14 deletions NOTICE.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
Serverless Image Handler

Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

**********************
THIRD PARTY COMPONENTS
**********************
This software includes third party software subject to the following copyrights:

aws-sdk under the Apache License Version 2.0
aws-sdk-mock under the Apache License Version 2.0
Bootstrap under the Massachusetts Institute of Technology (MIT) license
chai under the Massachusetts Institute of Technology (MIT) license
minimist under the Massachusetts Institute of Technology (MIT) license
axios under the Massachusetts Institute of Technology (MIT) license
axios-mock-adapter under the Massachusetts Institute of Technology (MIT) license
bootstrap under the Massachusetts Institute of Technology (MIT) license
color under the Massachusetts Institute of Technology (MIT) license
color-name under the Massachusetts Institute of Technology (MIT) license
jest under the Massachusetts Institute of Technology (MIT) license
mocha under the Massachusetts Institute of Technology (MIT) license
moment under the Massachusetts Institute of Technology (MIT) license
npm-run-all under the Massachusetts Institute of Technology (MIT) license
nyc under the ISC license
sharp under the Apache License Version 2.0
sinon under the BSD-3-Clause license
sinon-chai under the BSD-2-Clause license
uuid under the Massachusetts Institute of Technology (MIT) license
color under the Massachusetts Institute of Technology (MIT) license
color-name under the Massachusetts Institute of Technology (MIT) license
uuid under the Massachusetts Institute of Technology (MIT) license
24 changes: 8 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
**_Important Notice:_**
Due to a [change in the AWS Lambda execution environment](https://aws.amazon.com/blogs/compute/upcoming-updates-to-the-aws-lambda-execution-environment/), Serverless Image Handler v3 deployments are functionally broken. To address the issue we have released [minor version update v3.1.1](https://solutions-reference.s3.amazonaws.com/serverless-image-handler/v3.1.1/serverless-image-handler.template). We recommend all users of v3 to run cloudformation stack update with v3.1.1. Additionally, we suggest you to look at v4 of the solution and migrate to v4 if it addresses all of your use cases.
Due to a [change in the AWS Lambda execution environment](https://aws.amazon.com/blogs/compute/upcoming-updates-to-the-aws-lambda-execution-environment/), Serverless Image Handler v3 deployments are functionally broken. To address the issue we have released [minor version update v3.1.1](https://solutions-reference.s3.amazonaws.com/serverless-image-handler/v3.1.1/serverless-image-handler.template). We recommend all users of v3 to run cloudformation stack update with v3.1.1. Additionally, we suggest you to look at v5 of the solution and migrate to v5 if it addresses all of your use cases.

# AWS Serverless Image Handler Lambda wrapper for SharpJS
A solution to dynamically handle images on the fly, utilizing Sharp (https://sharp.pixelplumbing.com/en/stable/).
Published version, additional details and documentation are available here: https://aws.amazon.com/solutions/serverless-image-handler/

_Note:_ it is recommend to build the application binary on Amazon Linux.
_Note:_ it is recommended to build the application binary on Amazon Linux.

## On This Page
- [Architecture Overview](#architecture-overview)
Expand All @@ -14,7 +14,7 @@ _Note:_ it is recommend to build the application binary on Amazon Linux.
- [License](#license)

## Architecture Overview
![Architecture](architecture.jpeg)
![Architecture](architecture.png)

The AWS CloudFormation template deploys an Amazon CloudFront distribution, Amazon API Gateway REST API, and an AWS Lambda function. Amazon CloudFront provides a caching layer to reduce the cost of image processing and the latency of subsequent image delivery. The Amazon API Gateway provides endpoint resources and triggers the AWS Lambda function. The AWS Lambda function retrieves the image from the customer's Amazon Simple Storage Service (Amazon S3) bucket and uses Sharp to return a modified version of the image to the API Gateway. Additionally, the solution generates a CloudFront domain name that provides cached access to the image handler API.

Expand Down Expand Up @@ -81,19 +81,11 @@ aws s3 sync ./global-s3-assets/ s3://$DIST_OUTPUT_BUCKET-$REGION/$SOLUTION_NAME/
- [@john-shaffer](https://github.com/john-shaffer) for [#158](https://github.com/awslabs/serverless-image-handler/pull/158)
- [@toredash](https://github.com/toredash) for [#174](https://github.com/awslabs/serverless-image-handler/pull/174), [#195](https://github.com/awslabs/serverless-image-handler/pull/195)
- [@lith-imad](https://github.com/lith-imad) for [#194](https://github.com/awslabs/serverless-image-handler/pull/194)
- [@pch](https://github.com/pch) for [#227](https://github.com/awslabs/serverless-image-handler/pull/227)
- [@atrope](https://github.com/atrope) for [#201](https://github.com/awslabs/serverless-image-handler/pull/201)
- [@bretto36](https://github.com/bretto36) for [#182](https://github.com/awslabs/serverless-image-handler/pull/182)

***
## License
Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.<br />
SPDX-License-Identifier: Apache-2.0
Binary file removed architecture.jpeg
Binary file not shown.
Binary file added architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 4 additions & 3 deletions deployment/build-s3-dist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ cp dist/custom-resource.zip $build_dist_dir/custom-resource.zip
echo "------------------------------------------------------------------------------"
echo "Generate the demo-ui manifest document"
echo "------------------------------------------------------------------------------"
cd $template_dir/manifest-generator
npm install
node app.js --target ../../source/demo-ui --output $build_dist_dir/demo-ui-manifest.json
cd $source_dir/demo-ui
manifest=(`find * -type f ! -iname ".DS_Store"`)
manifest_json=$(IFS=,;printf "%s" "${manifest[*]}")
echo "{\"files\":[\"$manifest_json\"]}" | sed 's/,/","/g' >> $build_dist_dir/demo-ui-manifest.json
63 changes: 0 additions & 63 deletions deployment/manifest-generator/app.js

This file was deleted.

13 changes: 0 additions & 13 deletions deployment/manifest-generator/package.json

This file was deleted.

3 changes: 3 additions & 0 deletions deployment/run-unit-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ npm test

cd $source_dir/image-handler
npm test

cd $source_dir/custom-resource
npm test
7 changes: 7 additions & 0 deletions source/constructs/lib/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
"in": "path",
"required": true,
"type": "string"
},
{
"name": "signature",
"in": "query",
"description": "Signature of the image",
"required": false,
"type": "string"
}
],
"responses": {},
Expand Down
52 changes: 51 additions & 1 deletion source/constructs/lib/constructs-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,38 @@ export class ConstructsStack extends cdk.Stack {
default: 'No',
allowedValues: [ 'Yes', 'No' ]
});
const enableSignatureParameter = new CfnParameter(this, 'EnableSignature', {
type: 'String',
description: `Would you like to enable the signature? If so, select 'Yes' and provide SecretsManagerSecret and SecretsManagerKey values.`,
default: 'No',
allowedValues: [ 'Yes', 'No' ]
});
const secretsManagerParameter = new CfnParameter(this, 'SecretsManagerSecret', {
type: 'String',
description: 'The name of AWS Secrets Manager secret. You need to create your secret under this name.',
default: ''
});
const secretsManagerKeyParameter = new CfnParameter(this, 'SecretsManagerKey', {
type: 'String',
description: 'The name of AWS Secrets Manager secret key. You need to create secret key with this key name. The secret value would be used to check signature.',
default: ''
});
const enableDefaultFallbackImageParameter = new CfnParameter(this, 'EnableDefaultFallbackImage', {
type: 'String',
description: `Would you like to enable the default fallback image? If so, select 'Yes' and provide FallbackImageS3Bucket and FallbackImageS3Key values.`,
default: 'No',
allowedValues: [ 'Yes', 'No' ]
});
const fallbackImageS3BucketParameter = new CfnParameter(this, 'FallbackImageS3Bucket', {
type: 'String',
description: 'The name of the Amazon S3 bucket which contains the default fallback image. e.g. my-fallback-image-bucket',
default: ''
});
const fallbackImageS3KeyParameter = new CfnParameter(this, 'FallbackImageS3Key', {
type: 'String',
description: 'The name of the default fallback image object key including prefix. e.g. prefix/image.jpg',
default: ''
});

// CFN descrption
this.templateOptions.description = `(SO0023) - Serverless Image Handler with aws-solutions-constructs: This template deploys and configures a serverless architecture that is optimized for dynamic image manipulation and delivery at low latency and cost. Leverages SharpJS for image processing. Template version ${VERSION}`;
Expand All @@ -76,6 +108,18 @@ export class ConstructsStack extends cdk.Stack {
{
Label: { default: 'Event Logging' },
Parameters: [ logRetentionPeriodParameter.logicalId ]
},
{
Label: { default: 'Image URL Signature (Note: Enabling signature is not compatible with previous image URLs, which could result in broken image links. Please refer to the implementation guide for details: https://docs.aws.amazon.com/solutions/latest/serverless-image-handler/considerations.html)' },
Parameters: [ enableSignatureParameter.logicalId, secretsManagerParameter.logicalId, secretsManagerKeyParameter.logicalId ]
},
{
Label: { default: 'Default Fallback Image (Note: Enabling default fallback image returns the default fallback image instead of JSON object when error happens. Please refer to the implementation guide for details: https://docs.aws.amazon.com/solutions/latest/serverless-image-handler/considerations.html)' },
Parameters: [ enableDefaultFallbackImageParameter.logicalId, fallbackImageS3BucketParameter.logicalId, fallbackImageS3KeyParameter.logicalId ]
},
{
Label: { default: 'Auto WebP' },
Parameters: [ autoWebPParameter.logicalId ]
}
]
}
Expand All @@ -97,7 +141,13 @@ export class ConstructsStack extends cdk.Stack {
sourceBucketsParameter,
deployDemoUiParameter,
logRetentionPeriodParameter,
autoWebPParameter
autoWebPParameter,
enableSignatureParameter,
secretsManagerParameter,
secretsManagerKeyParameter,
enableDefaultFallbackImageParameter,
fallbackImageS3BucketParameter,
fallbackImageS3KeyParameter
};

// Serverless Image Handler Construct
Expand Down
Loading

0 comments on commit 6a98ad9

Please sign in to comment.