-
Notifications
You must be signed in to change notification settings - Fork 293
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
serverless deploy -> Exited with code 1 #663
Comments
Issue looks as specific to |
Seeing this issue on Gitlab CI. |
hey @medikoo I'm facing the same issue here. Where did you move the issue? |
Here |
I tried Node V16, still get a the same error on my mac.
|
@patalwell uh sorry, the issue must be somewhere else then. Now that I looked again I'm seeing failures with node 16 as well. All I know is that on my CI it fails using |
In order to use those two versions you mentioned should I set this docker image in the serverless config? @ftruzzi |
@vivianedias-tw no, I was just saying that, given the same serverless config and packages, it fails with serverless running under the first docker image and it works under the second one |
Tried with python 3.7 and python3.8, still same issue.
Defaults to container for lambda builds and runtime selected. |
I'm experiencing the same issue, I think it is due to this docker run command:
When running the first part:
Adding quotes around the bin/sh'd command string fixes it.
I'll try to submit a pull request |
|
I'm facing almost the same error in a Python 3.9 runtime, but with a different error code of 125 on my Mac: |
I believe this is the error you get when Docker is not running? |
Hello everyone, thanks a lot for the reports. I've tried to reproduce the issue but with no luck - it works fine for me with the following config + requirements.
I'm using Node |
I did some more testing this morning and confirmed the fix I suggested was in fact not working. The issue was that I confused the serverless error description with the command being ran, the description had the command not properly quoted, but the command being ran was properly quoted. In my case, the cause of the error was a file not found in this setting:
Resolving this path fixed my problem. |
I followed the instructions on the tutorial to start and deploy a new project, and am now getting the For the tutorial, I am running it in a Python 3.6 runtime on a Mac with Intel Core i7 processor. |
Can you share a bit more @agneeshdg ? Do you have docker installed locally? I've tried to reproduce with |
Hi @pgrzesik I do have Docker installed and running locally. Is there any additional Docker configuration I need to do? |
@pgrzesik let me try to use your config params. I'm not sure non-linux would work with serverless since lambda inherently uses a linux OS. Glad to see Docker community has support for M1 chip though! That was a pain point for me in the past. Did you also happen to run the lambda? |
@pgrzesik tested your params, same issues. What does your package.json look like? |
@patalwell - could you upload a small repro example that I could run as-is on my side? Maybe there's something niche in our setups that makes the difference? |
Nope, that should be enough - could you run it with |
I'm having exactly the same problem, but instead of Exited with code 1 it says code 2. Not sure what to do 😕 |
Hello @mgermy 👋 Would you be able to provide more context around your specific case? Maybe you could provide a small reproducible example that I can run on my side? |
@pgrzesik I created an example so you could run the same on your side. I only omitted my AWS role and profile. My node version is v16.13.2. Below you'll find a screenshot of the error and the files used to run it. |
Thanks a lot @mgermy - I've tried to reproduce your specific issue and it seems like the problem is the
@patalwell Did you manage to resolve the problem on your side? |
@pgrzesik thanks for taking for taking a look at it for me. After a few hours trying to figure it out, I found out that the problem was with the installation of serverless on my computer. I suggest for anyone who is having the same problem to check with a simple |
I see similar issue, but when invoking
Interestingly everything works perfectly fine when using python3.8 (yes, I cleaned cache between runs) |
I got the same issue but when I check the requirements.txt file and I see one version of my library was not correct at all. |
Hi I had the same problem
|
I got the error when |
I think it's obvious that while #679 added extra logging, there's still more places where logs need to be added as different people have different reasons why |
I got the same issue, would anyone guide me how to fix it?
|
Hi, |
I had the same issue and after running
I'm using |
Hey, I am still struggling with this... can installing an older version of serverless-python-requirements help? This is really frustrating Update It turned out I was missing this, specifically for python 3.8:
This wasn't letting pip run so was stopping pip from doing the thing with the requirements. So, I installed it specifically for python 3.8 - I'd still really appreciate a proper reason why the dockerizePip = Trrue seems to be causing issues. Thanks |
Perhaps unrelated, but I was getting the same error message as everyone else and realized that I had a package in my |
Same error as @StayFoolisj. I am running it in an circleCI environment with Debian Buster. I constructed and pushed the image to ECR using awscli and docker. Serverless: [AWS ssm 200 0.097s 0 retries] getParameter({ Name: '/some/develop/stripe/api_key', WithDecryption: true })
Serverless: [AWS ssm 200 0.093s 0 retries] getParameter({ Name: '/some/gj_etl_dev/password', WithDecryption: true })
Serverless: Invoke deploy
Serverless: Invoke package
Serverless: Invoke aws:common:validate
Serverless: Invoke aws:common:cleanupTempDir
Serverless: Using Python specified in "runtime": python3.8
Serverless: Packaging Python WSGI handler...
Serverless: Generated requirements from /root/project/requirements.txt in /root/project/.serverless/requirements.txt...
Serverless: Installing requirements from /root/.cache/serverless-python-requirements/a2ea73dc49988805a15c032f014bf5554e49fa57a518148e4d4f91a35befaeb7_x86_64_slspyc/requirements.txt ...
Serverless: Docker Image: ********.dkr.ecr.*********.amazonaws.com/some-dependencies:${ENVIRONMENT}
Serverless: Using download cache directory /root/.cache/serverless-python-requirements/downloadCacheslspyc
Serverless: Running docker run --rm -v /root/.cache/serverless-python-requirements/a2ea73dc49988805a15c032f014bf5554e49fa57a518148e4d4f91a35befaeb7_x86_64_slspyc\:/var/task\:z -v /root/.cache/serverless-python-requirements/downloadCacheslspyc\:/var/useDownloadCache\:z *******.dkr.ecr.*********.amazonaws.com/some-dependencies:\$\{ENVIRONMENT\} /bin/sh -c 'chown -R 0\\:0 /var/useDownloadCache && python3.8 -m pip install -t /var/task/ -r /var/task/requirements.txt --cache-dir /var/useDownloadCache && chown -R 0\\:0 /var/task && chown -R 0\\:0 /var/useDownloadCache'...
Serverless: [AWS sts 200 0.056s 0 retries] getCallerIdentity({})
Error ---------------------------------------------------
Error: `docker run --rm -v /root/.cache/serverless-python-requirements/a2ea73dc49988805a15c032f014bf5554e49fa57a518148e4d4f91a35befaeb7_x86_64_slspyc:/var/task:z -v /root/.cache/serverless-python-requirements/downloadCacheslspyc:/var/useDownloadCache:z 500345361576.dkr.ecr.*********.amazonaws.com/some-dependencies:${ENVIRONMENT} /bin/sh -c chown -R 0\:0 /var/useDownloadCache && python3.8 -m pip install -t /var/task/ -r /var/task/requirements.txt --cache-dir /var/useDownloadCache && chown -R 0\:0 /var/task && chown -R 0\:0 /var/useDownloadCache` Exited with code 125
at ChildProcess.<anonymous> (/root/project/node_modules/child-process-ext/spawn.js:38:8)
at ChildProcess.emit (node:events:394:28)
at ChildProcess.emit (node:domain:475:12)
at maybeClose (node:internal/child_process:1064:16)
at Socket.<anonymous> (node:internal/child_process:450:11)
at Socket.emit (node:events:394:28)
at Socket.emit (node:domain:475:12)
at Pipe.<anonymous> (node:net:672:12)
This is my configuration: custom:
wsgi:
app: some.wsgi.application
pythonRequirements:
dockerImage: *****.dkr.ecr.us-east-2.amazonaws.com/some-dependencies:${ENVIRONMENT}
dockerizePip: true
usePoetry: false
The image was successfully built this way
Our requirements.txt is
|
@medikoo @pgrzesik could some more debugging be added, so more information is displayed than just error code 1 (maybe contents of stderr and stdout)? It's possible that each of us here has a different kind of issue and we are just piling up on this error. Having more information would also allow regular users to possibly find solution themselves as it is possible that it might be someting going on a local machine. For example many of us know that error code 125 is likely docker deamon not running, but if an output would be shown that person would likely resolve it himself. |
Serverless Framework, Python, Docker, AWS Lambda, Exited with code 125I fixed the same problem. No, in my case, Docker is running well. Problem locates in the docker image: On this image's docker hub, no such a tag. So Docker failed to pull the tag to local. As @tb102122 mentioned under this issue, This worked for me. |
@reznok (maybe a bit late): your issue looks like the encoding issue, see #442 (comment) (as @stevetran-96 also mentioned, but with a broken link) |
Just adding my experience - this was fixed after using I have added pythonRequirements:
dockerizePip: non-linux
dockerImage: public.ecr.aws/sam/build-python3.9:latest
slim: true
layer: true Now it is packaging without a problem |
Much like @AwolDes said, the issue is with provider:
name: aws
runtime: python3.8
... |
Yes, @pgrzesik, I changed the runtime from python 3.9 to python 3.8 and it deployed without problems. Do you know where can I find more templates and examples of build aws infrastructure using aws serverless or a course, thanks. |
Hey @HeyVictorDanilo 👋 Glad to hear you've been able to resolve that issue. You can look for some examples here: https://github.com/serverless/examples |
Facing the same issue when using Python3.9 on Github Actions during CI.
|
The python-requirements module throws this error without actually showing any pip errors. in my case I tried running the actual pip install command manually and saw that PIP returns an error for an incorrect package version. as soon as I fixed it, the error went away. if anything, it should capture any error messages and throw them instead of "exited with code 1" for docker, I guess you need to run "docker logs -f xxx" and see the actual pip output as well, look for errors and display them instead of just a 1 exit code. |
Thanks for reporting more @ilyatovbin-pp 🙇 Were you using the latest version of the plugin? Could you provide a simple way to reproduce that problem so I can diagnose it better? Thanks in advance 🙇 |
I was on v5.4.0. you can just put any non existing package name or version in requirements.txt to get this error.
then if you manually run the pip command from above you'll get the actual error:
I'm sure that if you display the pip error you'd solve a lot of headache for people |
`Generated requirements from /github/workspace/requirements.txt in /github/workspace/.serverless/requirements.txt Environment: linux, node 16.19.1, framework 3.28.1 (local) 3.29.0v (global), plugin 6.2.3, SDK 4.3.2 Experienced exactly the same problem, so far did not found solution... |
I've also been running into the same failure as above while trying to use serverless deploy inside of a docker container
|
Same error here, tested both with Python 3.9 and 3.8, x64 and arm64 (all combinations). I'm always getting:
Please follow the advice of @ilyatovbin-pp and add some logging because it's not clear what the problem is. My requirements.txt file is fine, I can deploy the lambda locally to AWS without problems, but it fails when ran on GitLab. Using version 6.0.0, as found in the changelog. |
I'm kind of embarrassed, but my problem was docker was not running on my mac when running sls deploy `Environment: darwin, node 18.15.0, framework 3.38.0 (local) 3.30.0v (global), plugin 7.2.0, SDK 4.5.1 Error: |
i encoutnered the same problem, the problem is gone with i remove the following packages from requirements.txt, seems like sometimes it is caused by package, nota problem from sls , any clue on this ? |
Are you certain it's a bug?
Is the issue caused by a plugin?
Are you using the latest version?
Is there an existing issue for this?
Issue description
Error:
docker run --rm -v /Users/bad_ape/Library/Caches/serverless-python-requirements/36d8e2271e2d9e8afb4b103da1d57dc91ab0ccc62422d1337b5a3a91dcc7c2d9_x86_64_slspyc:/var/task:z -v /Users/bad_ape/Library/Caches/serverless-python-requirements/downloadCacheslspyc:/var/useDownloadCache:z -u 0 lambci/lambda:build-python3.8 python3.8 -m pip install -t /var/task/ -r /var/task/requirements.txt --cache-dir /var/useDownloadCache
Exited with code 1Service configuration (serverless.yml) content
Command name and used flags
serverless deploy
Command output
Environment information
Serverless: Running "serverless" installed locally (in service node_modules) Framework Core: 2.72.0 (local) Plugin: 5.5.3 SDK: 4.3.0 Components: 3.18.1 MacOS Monterey 12.0.1 MB Pro 2021 Chip: Apple M1 Pro
The text was updated successfully, but these errors were encountered: