question

Rafael Rocha avatar image
Rafael Rocha asked

command 'ask lambda upload' results in large package

Hi,

I'm using the ask cli to upload my lambda function and I noticed that the size of my function is much larger than one example I got from the blueprints. Note in the image below how smaller the blueprint function is.

I'm running the command 'ask lambda upload -f myFunction' at the root of my node project. My question is, is that normal or do I need bundle my function with something like webpack?

alexa skills kitask cli
function-size.png (9.0 KiB)
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Brian@Amazon avatar image
Brian@Amazon answered

The normal cause of a large lambda deployment package (specifically in Node.js) would be the use dependencies. This is normal, and shouldn't be cause for alarm. Are you using any imports/npm packages which would contribute to this?

2 comments
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Rafael Rocha avatar image Rafael Rocha commented ·

I'm using a few npm packages and my node_modules folder is definitely the one responsible for the large package.

Is it possible to bundle the lambda in order to avoid uploading all the dependencies?

Also let's say I have a few dev dependencies (perhaps some testing framework, a test web server etc), I definitely do not want to upload those dependencies since they're used for testing purposes only. How do I deal with that scenario?

Thanks

0 Likes 0 ·
Brian@Amazon avatar image Brian@Amazon ♦ Rafael Rocha commented ·

Your best bet would be to set up a separate test environment, or make a modification/wrapper to the ask-cli such that it only zips certain subfolders.

0 Likes 0 ·