7

Error:

Running "serverless" from node_modules

Deploying serverless-flask to stage dev (us-east-1)

✖ Stack serverless-flask-dev failed to deploy (0s)
Environment: darwin, node 16.0.0, framework 3.1.1 (local) 3.1.1v (global), plugin 6.0.0, SDK 4.3.1
Credentials: Local, "default" profile
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues

Error:
Error: spawn docker ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
    at onErrorNT (node:internal/child_process:480:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)

I'm following these instructions (https://www.serverless.com/blog/flask-python-rest-api-serverless-lambda-dynamodb/) and can't seem to figure this out since the base app is in python and not javascript... most people who have solved this solved it using javascript.

3
  • Are you using serverless-python-requirements plugin ? Commented Feb 10, 2022 at 19:10
  • yes sorry i forgot to post the instructions i was following @TheSmartMonkey here they are - serverless.com/blog/… Commented Feb 10, 2022 at 20:06
  • If you are on 64-bit linux system , then there's not a great reason to actually use docker so you need to update the serverless.yml file with following changes:- dockerizePip: "false" or just remove the entry from serverless.yml file. In my case it was set to dockerizePip: non-linux .I just removed the entry and everything works fine!! Commented Feb 22, 2022 at 6:01

2 Answers 2

7

To solve this issue you need to update your serverless.yml file with these changes in the custom block

custom:
  pythonRequirements:
    pythonBin: python3
    dockerizePip: "false"

I also face the same issue my issue was with dockerizePip it was set to

dockerizePip: non-linux

either remove this entry from serverless.yml file or just set it to false

Sign up to request clarification or add additional context in comments.

2 Comments

Does serverless need nodejs and python3 in the same container in this case?
No, we need either python or Nodejs @KenJ not both
6

To be able to deploy your project with serverless-python-requirements you need to have docker on your machine (if you are on windows consider using docker desktop or a linux vm)

Why do I need Docker ?

When you do a sls deploy, serverless-python-requirements launch a docker container to install all the dependencies you've put in your requirements.txt file that will be used during the deployement process

You are getting this error because your container is not launch correctly

2 Comments

thanks, i installed docker and it worked like a charm in the deploy build process however I am now getting this error: Error: The security token included in the request is invalid. I'm not sure what security token they are talking about and where i would place it. Is that something i generate from docker?
maybe related to aws verify your .aws/credentials file AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are correct

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.