Title: Not defining a global provider.runtime breaks dockerizePip: true · Issue #781 · serverless/serverless-python-requirements · GitHub
Open Graph Title: Not defining a global provider.runtime breaks dockerizePip: true · Issue #781 · serverless/serverless-python-requirements
X Title: Not defining a global provider.runtime breaks dockerizePip: true · Issue #781 · serverless/serverless-python-requirements
Description: Are you certain it's a bug? Yes, it looks like a bug Are you using the latest plugin release? Yes, I'm using the latest plugin release Is there an existing issue for this? I have searched existing issues, it hasn't been reported yet Issu...
Open Graph Description: Are you certain it's a bug? Yes, it looks like a bug Are you using the latest plugin release? Yes, I'm using the latest plugin release Is there an existing issue for this? I have searched existing ...
X Description: Are you certain it's a bug? Yes, it looks like a bug Are you using the latest plugin release? Yes, I'm using the latest plugin release Is there an existing issue for this? I have searched e...
Opengraph URL: https://github.com/serverless/serverless-python-requirements/issues/781
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Not defining a global provider.runtime breaks dockerizePip: true","articleBody":"### Are you certain it's a bug?\r\n\r\n- [X] Yes, it looks like a bug\r\n\r\n### Are you using the latest plugin release?\r\n\r\n- [X] Yes, I'm using the latest plugin release\r\n\r\n### Is there an existing issue for this?\r\n\r\n- [X] I have searched existing issues, it hasn't been reported yet\r\n\r\n### Issue description\r\n\r\nWe have a project that uses different runtimes per function:\r\n`function1`: `docker`\r\n`function2`: `python3.9`\r\n\r\nBecause of this, in the `provider` section, we did not define a `runtime` setting, as we did this on an individual `function` level.\r\n(`package.individually` was set to `true`)\r\nWhen deploying this stack it caused no issue at all, untill we needed to set the `dockerizePip` to `true`\r\n\r\nDoing this caused the following error to appear:\r\n```\r\n× Stack application-dev failed to deploy (2s)\r\nEnvironment: linux, node 18.16.1, framework 3.33.0 (local), plugin 6.2.3, SDK 4.3.2\r\nCredentials: Local, environment variables\r\nDocs: docs.serverless.com\r\nSupport: forum.serverless.com\r\nBugs: github.com/serverless/serverless/issues\r\n\r\nError:\r\nRunning \"docker run --rm -v /home/vsts/.cache/serverless-python-requirements/312994c1479362d239d9d5bf26421488a6a04688248779b8d3d3ec9ec8d32241_x86_64_slspyc:/var/task:z -v /home/vsts/.cache/serverless-python-requirements/downloadCacheslspyc:/var/useDownloadCache:z public.ecr.aws/sam/build-undefined:latest-x86_64 /bin/sh -c chown -R 0\\:0 /var/useDownloadCache && python -m pip install -t /var/task/ -r /var/task/requirements.txt --cache-dir /var/useDownloadCache && chown -R 1001\\:122 /var/task && chown -R 1001\\:122 /var/useDownloadCache\" failed with: \"Unable to find image 'public.ecr.aws/sam/build-undefined:latest-x86_64' locally\r\ndocker: Error response from daemon: repository public.ecr.aws/sam/build-undefined not found: name unknown: The repository with name 'build-undefined' does not exist in the registry with id 'sam'.\r\nSee 'docker run --help'.\"\r\nerror Command failed with exit code 1.\r\ninfo Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.\r\n\r\n``` \r\n\r\nTracing back the error caused me to look where `public.ecr.aws/sam/build-` was used in the repository.\r\nIt led me [here](https://github.com/serverless/serverless-python-requirements/blob/e8b2e51c265792046bacc3946f22f7bd842c60e6/index.js#L103)\r\nAs in our usecase `serverless.service.provider.runtime` was not set on a project lvl, it caused the code to replace this with the string `undefined`.\r\n\r\nThis image ofcourse does not exist, causing the docker command to crash out.\r\nSetting the `provider.runtime` string to `python3.9` fixes this issue.\r\n\r\n### Service configuration (serverless.yml) content\r\n\r\n```yaml\r\nservice: application\r\n\r\nframeworkVersion: '3'\r\n\r\npackage:\r\n individually: true\r\n patterns:\r\n - '!./**/**'\r\n - .requirements.zip\r\n\r\nprovider:\r\n name: aws\r\n stage: ${sls:stage}\r\n timeout: 900 \r\n memorySize: 2048\r\n\r\n # if you do not define it here, it breaks the dockerizePip: true\r\n # remove the comment on the below line to fix the error\r\n # runtime: python3.9\r\n\r\n environment:\r\n ENV: ${sls:stage}\r\n DEPLOYED: TRUE\r\n\r\n # Lambda needs access to S3, secretsmanager, dynamodb and logs\r\n iam:\r\n role:\r\n statements:\r\n - Effect: Allow\r\n Action:\r\n - \"s3:*\"\r\n Resource: \"*\"\r\n\r\n - Effect: Allow\r\n Action:\r\n - \"secretsmanager:GetSecretValue\"\r\n Resource: \"*\"\r\n\r\n - Effect: Allow\r\n Action:\r\n - \"dynamodb:*\"\r\n Resource: \"*\"\r\n\r\n - Effect: Allow\r\n Action:\r\n - \"logs:*\"\r\n Resource: \"*\"\r\n\r\n # Serverless stores our docker image of the app in ECR\r\n ecr:\r\n images:\r\n appimage_scrape:\r\n path: ./\r\n file: scrape.dockerfile\r\n\r\nplugins:\r\n - serverless-python-requirements\r\n\r\ncustom:\r\n pythonRequirements:\r\n usePoetry: true\r\n dockerizePip: true\r\n requirePoetryLockFile: true\r\n zip: true\r\n slim: true\r\n strip: false\r\n \r\n\r\nfunctions:\r\n ma_scrape:\r\n environment:\r\n ENV: ${sls:stage}\r\n image:\r\n name: appimage_scrape\r\n events:\r\n # Invoke Lambda function every day at 6:15h UTC from Mon-Fri\r\n - schedule: cron(15 6 ? * MON-FRI *)\r\n\r\n ma_clean:\r\n handler: src.handler.run_clean\r\n runtime: python3.9\r\n environment:\r\n ENV: ${sls:stage}\r\n events:\r\n - s3:\r\n bucket: ${self:service}-${sls:stage}-databucket\r\n event: s3:ObjectCreated:*\r\n rules:\r\n - prefix: raw/\r\n existing: true\r\n forceDeploy: true\r\n package:\r\n patterns:\r\n - src/application/clean/**\r\n - src/application/common/**\r\n - src/handler.py\r\n\r\n ma_score:\r\n handler: src.handler.run_score\r\n runtime: python3.9\r\n environment:\r\n ENV: ${sls:stage}\r\n events:\r\n - s3:\r\n bucket: ${self:service}-${sls:stage}-databucket\r\n event: s3:ObjectCreated:*\r\n rules:\r\n - prefix: clean/\r\n - suffix: info.json\r\n existing: true\r\n forceDeploy: true\r\n package:\r\n patterns:\r\n - src/application/score/**\r\n - src/application/common/**\r\n - src/handler.py\r\n\r\n ma_match:\r\n handler: src.handler.run_match\r\n runtime: python3.9\r\n environment:\r\n ENV: ${sls:stage}\r\n events:\r\n # Invoke Lambda function every day at 6:45h UTC from Mon-Fri\r\n - schedule: cron(45 6 ? * MON-FRI *)\r\n \r\n package:\r\n patterns:\r\n - src/application/match/**\r\n - src/application/common/**\r\n - src/handler.py\r\n\r\n ma_send:\r\n handler: src.handler.run_send\r\n runtime: python3.9\r\n environment:\r\n ENV: ${sls:stage}\r\n events:\r\n # Invoke Lambda function every day at 7h UTC from Mon-Fri\r\n - schedule: cron(0 7 ? * MON-FRI *)\r\n \r\n package:\r\n patterns:\r\n - src/application/send/**\r\n - src/application/common/**\r\n - src/handler.py\r\n```\r\n\r\n\r\n### Command name and used flags\r\n\r\nserverless deploy --verbose --region eu-west-1 --stage dev\r\n\r\n### Command output\r\n\r\n```shell\r\n$ /home/vsts/work/1/s/node_modules/.bin/serverless deploy --verbose --region eu-west-1 --stage dev\r\n\r\nDeploying application to stage dev (eu-west-1)\r\n\r\nAdding Python requirements helper to .\r\nGenerating requirements.txt from poetry.lock\r\nParsed requirements.txt from pyproject.toml in /home/vsts/work/1/s/.serverless/requirements.txt\r\nInstalling requirements from \"/home/vsts/.cache/serverless-python-requirements/312994c1479362d239d9d5bf26421488a6a04688248779b8d3d3ec9ec8d32241_x86_64_slspyc/requirements.txt\"\r\nDocker Image: public.ecr.aws/sam/build-undefined:latest-x86_64\r\nUsing download cache directory /home/vsts/.cache/serverless-python-requirements/downloadCacheslspyc\r\nRunning docker run --rm -v /home/vsts/.cache/serverless-python-requirements/312994c1479362d239d9d5bf26421488a6a04688248779b8d3d3ec9ec8d32241_x86_64_slspyc\\:/var/task\\:z -v /home/vsts/.cache/serverless-python-requirements/downloadCacheslspyc\\:/var/useDownloadCache\\:z public.ecr.aws/sam/build-undefined\\:latest-x86_64 /bin/sh -c 'chown -R 0\\\\:0 /var/useDownloadCache && python -m pip install -t /var/task/ -r /var/task/requirements.txt --cache-dir /var/useDownloadCache && chown -R 1001\\\\:122 /var/task && chown -R 1001\\\\:122 /var/useDownloadCache'...\r\n\r\n× Stack application-dev failed to deploy (2s)\r\nEnvironment: linux, node 18.16.1, framework 3.33.0 (local), plugin 6.2.3, SDK 4.3.2\r\nCredentials: Local, environment variables\r\nDocs: docs.serverless.com\r\nSupport: forum.serverless.com\r\nBugs: github.com/serverless/serverless/issues\r\n\r\nError:\r\nRunning \"docker run --rm -v /home/vsts/.cache/serverless-python-requirements/312994c1479362d239d9d5bf26421488a6a04688248779b8d3d3ec9ec8d32241_x86_64_slspyc:/var/task:z -v /home/vsts/.cache/serverless-python-requirements/downloadCacheslspyc:/var/useDownloadCache:z public.ecr.aws/sam/build-undefined:latest-x86_64 /bin/sh -c chown -R 0\\:0 /var/useDownloadCache && python -m pip install -t /var/task/ -r /var/task/requirements.txt --cache-dir /var/useDownloadCache && chown -R 1001\\:122 /var/task && chown -R 1001\\:122 /var/useDownloadCache\" failed with: \"Unable to find image 'public.ecr.aws/sam/build-undefined:latest-x86_64' locally\r\ndocker: Error response from daemon: repository public.ecr.aws/sam/build-undefined not found: name unknown: The repository with name 'build-undefined' does not exist in the registry with id 'sam'.\r\nSee 'docker run --help'.\"\r\nerror Command failed with exit code 1.\r\ninfo Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.\r\nerror Command failed with exit code 1.\r\ninfo Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.\r\nyarn run v1.22.19\r\nwarning package.json: No license field\r\n```\r\n\r\n\r\n### Environment information\r\n\r\n```shell\r\nFramework Core: 3.33.0 (local)\r\nPlugin: 6.2.3\r\nSDK: 4.3.2\r\n\r\n\r\nserverless-python-requirements: 6.0.0\r\n```\r\n\r\n## Solution/ workaround\r\nUnder the provider section, define your runtime (like `python 3,9`)\r\n","author":{"url":"https://github.com/ToneVDB","@type":"Person","name":"ToneVDB"},"datePublished":"2023-07-24T10:58:36Z","url":"https://github.com/serverless/serverless-python-requirements/issues/781"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:c23a293b-466f-b32e-1867-e53cf0bd9ced |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8938:319373:C1BD6:10ABBF:6B04330F |
| html-safe-nonce | cb19f1fd447bc8a720963a7f406e5dfeb9c29a3045ec970d1c7dc17609e66602 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4OTM4OjMxOTM3MzpDMUJENjoxMEFCQkY6NkIwNDMzMEYiLCJ2aXNpdG9yX2lkIjoiNDM0NTMwNzM1MTA0NjQzNTU5OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | a2af6490f88fc55a121138c7246a787436d81d8a9c396b8ca135ee1e8f8ebd85 |
| hovercard-subject-tag | issue:1818177805 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/serverless/serverless-python-requirements/781/issue_layout |
| twitter:image | https://opengraph.githubassets.com/13bc8f8dc213d9d2363212ad2354bcdf8a59762d4f7b58a41ebdc926ee6aead9/serverless/serverless-python-requirements/issues/781 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/13bc8f8dc213d9d2363212ad2354bcdf8a59762d4f7b58a41ebdc926ee6aead9/serverless/serverless-python-requirements/issues/781 |
| og:image:alt | Are you certain it's a bug? Yes, it looks like a bug Are you using the latest plugin release? Yes, I'm using the latest plugin release Is there an existing issue for this? I have searched existing ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ToneVDB |
| hostname | github.com |
| expected-hostname | github.com |
| None | b7a1d2b9101496921b08579fbee988d014345aef2f5bd660d1f8c7332d81560e |
| turbo-cache-control | no-preview |
| go-import | github.com/serverless/serverless-python-requirements git https://github.com/serverless/serverless-python-requirements.git |
| octolytics-dimension-user_id | 13742415 |
| octolytics-dimension-user_login | serverless |
| octolytics-dimension-repository_id | 76508594 |
| octolytics-dimension-repository_nwo | serverless/serverless-python-requirements |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 76508594 |
| octolytics-dimension-repository_network_root_nwo | serverless/serverless-python-requirements |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | c3dd496c3da6ea6b77e69c09279d2b81604654f1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width