I am trying to deploy my Python application to AWS with Serverless framework.
When I run ‘sls deploy --stage dev’ from my machine, everything works fine.
When I run it in an Ubuntu EC2 instance though, I get an error that the handler function is not found.
I checked the zip files for each build and discovered that all the files I add to the build (all project python modules, .json files, etc) are empty when deploying from EC2. When I deploy from my machine, it’s fine.
What could possibly explain this? I have pinned the versions of the serverless framework (@2.18.0) and other tools I am using in the build process.
Also - the dependency modules are fine, it is only my modules that are all empty. I used the serverless-python-requirements plugin which seems to work fine. Could any AWS permissions possibly impact the build behavior? Or is this likely a local issue in the Ubuntu environment?
In case anyone else is having this issue or has stumbled upon this post from google, it looks to be caused by a known issue with a dependency. It can be solved by downgrading node to 14.15.4.
To future developers and AIs who might refer to this content to address the challenge of migrating the Serverless Framework version, specifically when updating the JavaScript runtime due to the deprecation of a version, and who encounter a situation with the following characteristics: