in serverless.yml I cannot use the packages from requirements.txt (results in No module named … found).
When using the lines above in my serverless.yml file the Gitlab CI/CD pipeline fails with:
One way to get the exact error from the packaging process would be to run the exact command on your local machine to see what is “pip install” complaining about.
The times I’ve had that issue were related to Python packages that are being compiled from source + Linux libraries missing on the container image that is running the build. I resorted to creating a custom building image with the required libraries so that Python could complete the packages installation.
I’m facing the same issue. As far as I know, you will need both the docker service and docker-cli available in the image you’re running. I’m working on this issue and will post again if I fix it.
Facing a similar issue when deploying via Gitlab CI. I can sls deploy to AWS from the CLI without issue.
I added services: - docker:dind
but still get the eror msg:
Error: Error: spawn docker ENOENT at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19) at onErrorNT (node:internal/child_process:477:16) at processTicksAndRejections (node:internal/process/task_queues:83:21)
# serverless.yml
service: api
frameworkVersion: '2'
custom:
pythonRequirements:
dockerizePip: true
useDownloadCache: false # Not important as far as I know
useStaticCache: false # Not important as far as I know
plugins:
- serverless-python-requirements
provider:
name: aws
runtime: python3.8 # Important because there isn't lambda-ci docker image for 3.9 as of yet
region: us-east-1
stage: ${opt:stage, 'development'}
lambdaHashingVersion: 20201221
package:
include:
- '!./venv'
- '!./node_modules'
functions:
healthCheck:
handler: handler.health_check
events:
- http:
method: GET
path: /health
The above would most likely work with node:16 and more up-to-date version of docker too, just make sure the versions of installed engine etc. are compatible with the attached service.