aws-amplify / aws-amplify/amplify-cli
Packaging Python lambda layer fails to include platlib libraries (lib64)
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 825
- Avg merge
- 11d 23h
- Merged PRs (30d)
- 2
Description
### How did you install the Amplify CLI?
_No response_
### If applicable, what version of Node.js are you using?
_No response_
### Amplify CLI Version
latest
### What operating system are you using?
Amazon Linux 2
### Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
Added a lambda function, edited the function, and pushed.
### Describe the bug
[This function](https://github.com/aws-amplify/amplify-cli/blob/8f632c20c5a0d6c0da819d7cd971a1856a1add40/packages/amplify-python-function-runtime-provider/src/util/packageUtils.ts#L16C10-L16C10) fails to include lib64 libraries when packaging up dependencies for execution on a Lambda function in service contexts. On Amazon Linux 2 (and some other Linux distros) platlib != purelib, so lib != lib64. All of the libraries in pipenv are necessary for executing Lambda functions, not just the purelib ones.
### Expected behavior
I would expect both lib and lib64 to be packaged up, but lib64 is ignored.
### Reproduction steps
Include a Python library with a platlib on Amazon Linux 2 (e.g. charset-normalizer, a dependency of requests) in an amplify-specified Lambda function. amplify push from an instance running Amazon Linux 2 where context.service is true (for example, one of the pre-provisioned build instances). The Lambda function will fail to import all lib64 libraries.
### Project Identifier
_No response_
### Log output
```
# Put your logs below this line
```
### Additional information
_No response_
### Before submitting, please confirm:
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- [X] I have removed any sensitive information from my code snippets and submission.
Contributor guide
Research direction
Start with packages/amplify-python-function-runtime-provider/src/util/packageUtils.ts at the linked packaging logic, then reproduce the issue on Amazon Linux 2 with context.service set to true and a library such as charset-normalizer. Done means the packaged Lambda dependencies include both purelib and platlib libraries, including lib64 contents.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, python, typescript
- Domain
- build-system, cli, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 46/100