logandk/serverless-wsgi

empty serverless_wsgi.py and wsgi_handler.py files in zip package

jmcgrath207 opened this issue · 3 comments

Hey all,

I am having issue when I deploy to aws lambda where it can't find the wsgi_handler.handler entry point. What I found when looking in the zip package in the .serverless folder was the zip package did contain the serverless_wsgi.py and wsgi_handler.py files but the files themself were completely empty (no python code). This occurs with this configuration.

plugins:
 - serverless-wsgi
 - serverless-python-requirements
 - serverless-pseudo-parameters
 wsgi:
   app: app.app
   packRequirements: false
   pythonBin: python
 pythonRequirements:
   pythonBin: python

provider:
 name: aws
 runtime: python3.8
 stage: dev
 region: us-east-1


functions:
 app:
   handler: wsgi_handler.handler
   events:
     - http: ANY /
     - http: ANY {proxy+}

However if I change packRequirements: false to packRequirements: true it makes the serverless_wsgi.py and wsgi_handler.py files appear in my template directory and the files do contain python code similar to the repo, however the .serverless folder disappears.

I am using serverless-wsgi version 1.7.6

The command I am using is SLS_DEBUG=* sls deploy --config template.yaml

This might be related to #161

Hello everyone,

I'm also running into this problem. Does anyone have any idea how we can address this issue?

Thank you.

-R.

Hey @jmcgrath207

I did some digging in the internals of the plugin and the files are packaged correctly.

The problem seems to occur when the package is compressed and ready to be uploaded to AWS. After more research I found this issue: serverless/serverless#8794

If you're running node v15, try downgrading to v14.15.4. It worked on my end!

Best.

-R.

Hey @renatogcarvalho

Thanks for looking into that for me, that's got to be it! If I have time to test I will update this, but for now I am just using the python files from the repo instead and those work great!