Skip to content

Commit

Permalink
Update cache code to reflect shape of response
Browse files Browse the repository at this point in the history
  • Loading branch information
mbklein committed Aug 15, 2023
1 parent 603bac6 commit 7a5310a
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 15 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
.aws
.aws-sam
deploy.yaml
node_modules
samconfig.toml
env.json
package.yml
samconfig.toml

Expand All @@ -23,4 +26,5 @@ env.json
*~undo-tree~
.DS_Store
sharp-lambda-layer.*
*.log
*.log
.vscode
4 changes: 2 additions & 2 deletions dependencies/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dependencies/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "serverless-iiif-dependencies",
"version": "4.3.3",
"version": "4.3.4",
"description": "Dependencies for serverless IIIF",
"author": "Michael B. Klein",
"license": "Apache-2.0",
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "serverless-iiif",
"version": "4.3.3",
"version": "4.3.4",
"description": "Lambda wrapper for iiif-processor",
"author": "Michael B. Klein",
"license": "Apache-2.0",
Expand Down
4 changes: 2 additions & 2 deletions sam/cloudfront/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Metadata:
ReadmeUrl: ../../README.md
Labels: ["iiif", "image-processing"]
HomePageUrl: https://github.com/samvera/serverless-iiif
SemanticVersion: 4.3.3
SemanticVersion: 4.3.4
SourceCodeUrl: https://github.com/samvera/serverless-iiif
AWS::CloudFormation::Interface:
ParameterGroups:
Expand Down Expand Up @@ -365,7 +365,7 @@ Resources:
Location: ../standalone/template.yml
# Location:
# ApplicationId: arn:aws:serverlessrepo:us-east-1:625046682746:applications/serverless-iiif-standalone
# SemanticVersion: 4.3.3
# SemanticVersion: 4.3.4
Parameters:
CacheBucket: !Ref CacheBucket
CorsAllowCredentials: !Ref CorsAllowCredentials
Expand Down
2 changes: 1 addition & 1 deletion sam/standalone/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Metadata:
ReadmeUrl: ../../README.md
Labels: ["iiif", "image-processing"]
HomePageUrl: https://github.com/samvera/serverless-iiif
SemanticVersion: 4.3.3
SemanticVersion: 4.3.4
SourceCodeUrl: https://github.com/samvera/serverless-iiif
AWS::CloudFormation::Interface:
ParameterGroups:
Expand Down
2 changes: 1 addition & 1 deletion src/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const makeCache = (key, image) => {

return new Promise((resolve, reject) => {
if (!cacheConfigured()) {
reject(new Error(`Content size (${image.length.toString()}) exceeds API gateway maximum`));
reject(new Error(`Content size (${image?.length?.toString()}) exceeds API gateway maximum`));
}

const s3 = new AWS.S3();
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const handleImageRequestFunc = async (uri, resource) => {
const result = await resource.execute();

if (isTooLarge(result.body)) {
await makeCache(key, result);
await makeCache(key, result.body);
response = forceFailover();
} else {
response = makeResponse(result);
Expand Down
4 changes: 2 additions & 2 deletions src/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "serverless-iiif",
"version": "4.3.3",
"version": "4.3.4",
"description": "Lambda wrapper for iiif-processor",
"author": "Michael B. Klein",
"license": "Apache-2.0",
Expand Down

0 comments on commit 7a5310a

Please sign in to comment.