Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[aws-lambda-python] Building fails because rsync does not exist in SAM build image for Python 3.8 #9349

Closed
jarikujansuu opened this issue Jul 30, 2020 · 0 comments · Fixed by #9355 or #9763
Assignees
Labels
@aws-cdk/aws-lambda-python bug This issue is a bug. in-progress This issue is being actively worked on. needs-triage This issue or PR still needs to be triaged.

Comments

@jarikujansuu
Copy link

jarikujansuu commented Jul 30, 2020

PythonFunction tries to run rsync on build container but SAM build image for Python 3.8 doesn't have it. Default 3.7 image would have it.

Reproduction Steps

const app = new App();

class FoobarStack extends Stack {
  constructor(scope: Construct, id: string)  {
    super(scope, id);
    new PythonFunction(this, 'Foobar', {
      entry: './lambda/foobar',
      runtime: Runtime.PYTHON_3_8,
    })
  }
}

new FoobarStack(app, 'foobar');

...and then lambda/foobar directory with index.py and empty requirements.txt

Error Log

(node:59945) ExperimentalWarning: Conditional exports is an experimental feature. This feature could change at any time
npx: installed 8 in 1.047s
Bundling asset foobar/Foobar/Code/Stage...
WARNING: The directory '/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
WARNING: The directory '/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
bash: rsync: command not found
Failed to run bundling Docker image for asset foobar/Foobar/Code/Stage: Error: docker exited with status 127
Subprocess exited with error 1

Environment

  • CLI Version : 1.55.0 (build 48ccf09)
  • Framework Version: 1.55.0
  • Node.js Version: v13.8.0
  • OS : Mac OS 19.14.6
  • Language (Version): TypeScript (3.9.7) but should be for all

Other


This is 🐛 Bug Report

@jarikujansuu jarikujansuu added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jul 30, 2020
@SomayaB SomayaB changed the title [aws-lambda-python] Building fails because rsync does not exist in SAM build image for Python 3.8 [aws-lambda] Building fails because rsync does not exist in SAM build image for Python 3.8 Jul 31, 2020
@SomayaB SomayaB added the language/python Related to Python bindings label Jul 31, 2020
@github-actions github-actions bot added the @aws-cdk/aws-lambda Related to AWS Lambda label Jul 31, 2020
@SomayaB SomayaB added the in-progress This issue is being actively worked on. label Jul 31, 2020
@SomayaB SomayaB changed the title [aws-lambda] Building fails because rsync does not exist in SAM build image for Python 3.8 [aws-lambda-python] Building fails because rsync does not exist in SAM build image for Python 3.8 Jul 31, 2020
@SomayaB SomayaB assigned eladb and unassigned ericzbeard Jul 31, 2020
@SomayaB SomayaB added @aws-cdk/aws-lambda-python and removed @aws-cdk/aws-lambda Related to AWS Lambda language/python Related to Python bindings labels Jul 31, 2020
@mergify mergify bot closed this as completed in #9355 Aug 3, 2020
mergify bot pushed a commit that referenced this issue Aug 3, 2020
Fixes #9349.

The python 3.8 `bundlingDockerImage` (`amazon/aws-sam-cli-build-image-python3.8`) is based on `amazonlinux:2` and doesn't include `rsync`; use `cp` instead.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
curtiseppel pushed a commit to curtiseppel/aws-cdk that referenced this issue Aug 11, 2020
Fixes aws#9349.

The python 3.8 `bundlingDockerImage` (`amazon/aws-sam-cli-build-image-python3.8`) is based on `amazonlinux:2` and doesn't include `rsync`; use `cp` instead.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
mergify bot pushed a commit that referenced this issue Aug 19, 2020
Fixes #9704.

`aws-lambda-python` originally used `rsync` to move lambda code into `/asset-output`, but I switched to `cp` in #9355 to resolve #9349 as `rsync` isn't installed in the python3.8 sam docker image.

This change introduces a Dockerfile derived from the `bundlingDockerImage` of the runtime which installs `rsync` if it's missing.

While this feels a bit heavy-handed, I had been planning to introduce a Dockerfile to setup a working pip cache after #9582 lands.

I'm also happy to take a different approach if you'd prefer, @eladb. 

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
misterjoshua pushed a commit to misterjoshua/aws-cdk that referenced this issue Aug 19, 2020
Fixes aws#9704.

`aws-lambda-python` originally used `rsync` to move lambda code into `/asset-output`, but I switched to `cp` in aws#9355 to resolve aws#9349 as `rsync` isn't installed in the python3.8 sam docker image.

This change introduces a Dockerfile derived from the `bundlingDockerImage` of the runtime which installs `rsync` if it's missing.

While this feels a bit heavy-handed, I had been planning to introduce a Dockerfile to setup a working pip cache after aws#9582 lands.

I'm also happy to take a different approach if you'd prefer, @eladb. 

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-lambda-python bug This issue is a bug. in-progress This issue is being actively worked on. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants