Serverless deploy, exclude npm package?

aws
lambda

#1

Hi guys

This may be a very basic question, but I have this little issue. When I add AWS X-Ray SDK to my node.js Lambda function, and then deploy it, it insists on bringing with it the AWS SDK. The AWS SDK is already part of the Lambda service, so this only serves to bloat the package size as far as I can tell (and makes sure I can’t see the function content in the Lambda console). I have tested deleting the package manually before deploying, and the function (and X-Ray) still works fine after i deploy without AWS SDK. I tried adding AWS SDK as an explicit development dependency (–save-dev), but that didn’t help either.

I tried looking around a little, but didn’t immediately stuble upon the solution to exclude AWS SDK from my deploys. Anyone?

Regards,
Olav


#2

Found it in the documentation. That’s what you get for being too tired. For others:

package:
exclude:
- node_modules/aws-sdk/**