6

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.

Bruno Marques
  • 89
  • 1
  • 6
  • Are you using `serverless-python-requirements` plugin ? – TheSmartMonkey Feb 10 '22 at 19:10
  • yes sorry i forgot to post the instructions i was following @TheSmartMonkey here they are - https://www.serverless.com/blog/flask-python-rest-api-serverless-lambda-dynamodb/ – Bruno Marques Feb 10 '22 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!! – Bharat Feb 22 '22 at 06:01

2 Answers2

6

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

Abraham
  • 8,525
  • 5
  • 47
  • 53
Bharat
  • 201
  • 2
  • 9
4

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

TheSmartMonkey
  • 857
  • 1
  • 7
  • 23
  • 1
    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? – Bruno Marques Feb 10 '22 at 21:16
  • maybe related to aws verify your `.aws/credentials` file AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are correct – TheSmartMonkey Feb 10 '22 at 23:48