I have a typescript graphql project that uses circleci to deploy as a serverless lambda to various environments. When I deploy manually with: sls deploy --stage dev, the package size is close to 60 MB. Well within the AWS size limits.
However, with circleci the size increases to 78 MB and gets rejected by AWS. I am not sure what other config options need to be added to the config.yml file to get the package to an acceptable deployment size. Any thoughts? Thanks in advance.
I think your best bet to troubleshoot this is to ssh into the container and inspect the generated package from the command line before trying to deploy. You might find it’s including a bunch of extra files that aren’t included locally. Other users have reported similar issues with other ci services. It turned out dev dependencies were being installed which added a lot of bloat.
It’s been a few years since i’ve created and deployed lambdas, but I’m pretty sure you can inspect the package before it’s deployed. SSHing into the container will make it easy to inspect and compare what is being generated locally to what you have in the job. I’m not sure what language you’re using but making sure only production dependencies are installed is a good place to start.
Thanks @fernfernfern !
You can ssh into the container and see the package produced by the serverless deployment function. However, my issue has been solved by changing my package manager from yarn to npm. I am not sure why that fixed it, though. Anyone else who stumbles on the topic can try that first if they are still using yarn.