aws-amplify / aws-amplify/amplify-cli

Lambda layer with additional software does not work

Open
#6,144 12 comments 1 reaction 1 assignee Claimed by @josefaidt View on GitHub
dependency-issue feature-request functions lambda-layers
Dominant language
TypeScript
Stars
2.9k
Forks
825
Avg merge
11d 23h
Merged PRs (30d)
2

Description

**Describe the bug**
Created a custom lambda layer with ImageMagick and ghostscript software, installed with [yumda](https://github.com/lambci/yumda) where all the binaries were installed in the opt folder.

When doing though amplify status or amplify push I get the error: An error occurred hashing directory

**To Reproduce**
Steps to reproduce the behavior:

1. Install ImageMagick and ghostscript with yumda and mounting the /opt to the opt folder of the layer:
`docker run --rm -v /xxx/amplify/backend/function/layer_name/opt:/lambda/opt lambci/yumda:2 yum install -y ghostscript ImageMagick`

2. Do `amplify status`

3. The following error is thrown:
An error occurred hashing directory /Users/xxx/yyy/zzz/amplify/backend/function/nodejs/opt
Error: An error occurred hashing directory /Users/xxx/yyy/zzz/amplify/backend/function/nodejs/opt
at /usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-function/lib/provider-utils/awscloudformation/utils/packageLayer.js:139:19
at async safeHash (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-function/lib/provider-utils/awscloudformation/utils/packageLayer.js:138:17)
at async Promise.all (index 2)
at async Object.exports.hashLayerVersionContents (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-function/lib/provider-utils/awscloudformation/utils/packageLayer.js:130:27)
at async exports.hashLayerResource (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-function/lib/provider-utils/awscloudformation/utils/packageLayer.js:118:17)
at async isBackendDirModifiedSinceLastPush (/usr/local/lib/node_modules/@aws-amplify/cli/lib/extensions/amplify-helpers/resource-status.js:46:26)
at async /usr/local/lib/node_modules/@aws-amplify/cli/lib/extensions/amplify-helpers/resource-status.js:165:41
at async asyncForEach (/usr/local/lib/node_modules/@aws-amplify/cli/lib/extensions/amplify-helpers/resource-status.js:238:9)
at async /usr/local/lib/node_modules/@aws-amplify/cli/lib/extensions/amplify-helpers/resource-status.js:158:9
at async asyncForEach (/usr/local/lib/node_modules/@aws-amplify/cli/lib/extensions/amplify-helpers/resource-status.js:238:9

**Expected behavior**
Amplify should be able to cope with the layer and by pushing the changes it should create the deployment package and upload it.

**Smartphone (please complete the following information):**

- Device: MacBook Pro
- OS: macOS Big Sur
- Browser Google Chome, Safari

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.