Serverless not including my node_modules

Question:

I have a nodejs serverless project that has this structure:

my serverless.yml:

my sls info shows:

When I run sls:

it works and my script where I included googleapis and aws-sdk work. But when I deploy, those functions are skipped and show no error.

Answer:

When debugging serverless‘s packaging process, use sls package (or sls deploy --noDeploy (for old versions). You’ll get a .serverless directory that you can inspect to see what’s inside the deployment package.

From there, you can see if node_modules is included or not and make changes to your serverless.yml correspondingly without needing to deploy every time you make a change.

Leave a Reply