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

fix: mixing runtimes and architectures #815

Conversation

stijzermans
Copy link
Contributor

@stijzermans stijzermans commented Jan 10, 2024

while running a setup where combining Python and NodeJS lambda's, I ran into a couple of issues:

  1. packaging of mixed runtime (as mentioned in Mixing nodejs and python results in "ENOENT: no such file or directory, scandir '.serverless/requirement" #688 ) would lead to the following error:
STDOUT:  Error:
[OperationalError: ENOENT: no such file or directory, scandir '.serverless/requirements'] {
  cause: [Error: ENOENT: no such file or directory, scandir '.serverless/requirements'] {
    errno: -2,
    code: 'ENOENT',
    syscall: 'scandir',
    path: '.serverless/requirements'
  },
  isOperational: true,
  errno: -2,
  code: 'ENOENT',
  syscall: 'scandir',
  path: '.serverless/requirements'
}
  1. dockerizePip image would always default to provider.runtime / provider.architecture
    which would lead to the following error:
Running "docker run --rm <mounts> -u 0 public.ecr.aws/sam/build-nodejs18.x:latest-arm64 python -m pip install -t /var/task/ -r /var/task/requirements.txt --cache-dir /var/useDownloadCache" failed with: "/usr/bin/python: No module named pip"

therefore I've adjusted

  1. zipping to be to only be performed on either functions which runtimes are specifically python, or no runtime is set and provider.runtime is python3.

  2. to take function options as argument for retrieving the docker image.

@stijzermans stijzermans changed the title fix: mixing runtimes and architectures in serverless (#688) fix: mixing runtimes and architectures in serverless Jan 10, 2024
@stijzermans stijzermans changed the title fix: mixing runtimes and architectures in serverless fix: mixing runtimes and architectures Jan 10, 2024
@stijzermans
Copy link
Contributor Author

cc: @pgrzesik - would be great if you could take a look whenever time permits!

Copy link
Contributor

@pgrzesik pgrzesik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @stijzermans 🙇 Great improvements 👏 Let's make sure the tests are passing and we should be good to go here 👍

@@ -185,6 +180,18 @@ class ServerlessPythonRequirements {
this.commands.requirements.type = 'container';
}

this.dockerImageForFunction = (funcOptions) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants