Miserlou/Zappa

struggling with GET request to / yielded a 502 response code

bhontz opened this issue · 0 comments

I've been struggling updating an existing project (which zappa was providing an endpoint for) now that I've added pyrebase to my project.

I seemed to have pinpointed the problem down to the addition of the pyrebase module (will work excluding my calls to pyrebase methods, but not when included).

The symptom is "Runtime.ImportModuleError: Unable to import module 'handler': attempted relative import with no known parent package"

I noted that during the zappa update an message indicates that the zappa module needs requests > 21.20.0 whereas pyrebase requires 21.11.1. I uninstalled zappa from my venv, reinstalling it outside of the venv and also assuring that requests==2.25.1 is also installed outside of the venv.

While the requests conflict message now goes away during the zappa update, I still end up with the GET request to / yielded a 502 response code if I have the pyrebase module included within my code. If I comment out references to pyrebase within the code, including importing it, zappa will update and provide an endpoint.

If I try to access the endpoint, after receipt of the GET request to / yielded a 502 response code, I receive:
"{'message': 'An uncaught exception happened while servicing this request. You can investigate this with the `zappa tail` command.', 'traceback': ['Traceback (most recent call last):\\n', ' File \"/var/task/handler.py\", line 540, in handler\\n with Response.from_app(self.wsgi_app, environ) as response:\\n', ' File \"/var/task/werkzeug/wrappers/base_response.py\", line 287, in from_app\\n return cls(*_run_wsgi_app(app, environ, buffered))\\n', ' File \"/var/task/werkzeug/wrappers/base_response.py\", line 26, in _run_wsgi_app\\n return _run_wsgi_app(*args)\\n', ' File \"/var/task/werkzeug/test.py\", line 1119, in run_wsgi_app\\n app_rv = app(environ, start_response)\\n', \"TypeError: 'NoneType' object is not callable\\n\"]}

Similarly, running zappa tail produces:
[1614978584986] [ERROR] Runtime.ImportModuleError: Unable to import module 'handler': attempted relative import with no known parent package

... among a whole lot of other output I'm not understanding, and then seems to hang just after displaying the message above.

There are references in both instances above to importing the handler module; can anyone lend a hand to help me interpet what's going on here and as a consequence find a remedy?

Your Environment

Mac OSx 11.2.2
python 3.7.7

{
"dev": {
"app_function": "app.app",
"profile_name": "zappa",
"project_name": "applereader",
"runtime": "python3.7",
"s3_bucket": "zappa-5who8sbtu"
}
}

argcomplete==1.12.2
boto3==1.16.47
botocore==1.19.47
certifi==2020.12.5
cfn-flip==1.2.3
chardet==3.0.4
click==7.1.2
durationpy==0.5
Flask==1.1.2
future==0.18.2
gcloud==0.17.0
googleapis-common-protos==1.53.0
hjson==3.0.2
httplib2==0.19.0
idna==2.10
importlib-metadata==3.3.0
itsdangerous==1.1.0
Jinja2==2.11.2
jmespath==0.10.0
jws==0.1.3
kappa==0.6.0
MarkupSafe==1.1.1
oauth2client==3.0.0
pip-tools==5.5.0
placebo==0.9.0
protobuf==3.15.5
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycryptodome==3.4.3
pyparsing==2.4.7
Pyrebase==3.0.27
python-dateutil==2.8.1
python-jwt==2.0.1
python-slugify==4.0.1
PyYAML==5.3.1
requests==2.11.1
requests-toolbelt==0.7.0
rsa==4.7.2
s3transfer==0.3.3
six==1.15.0
text-unidecode==1.3
toml==0.10.2
tqdm==4.55.1
troposphere==2.6.3
typing-extensions==3.7.4.3
urllib3==1.26.2
Werkzeug==0.16.1
wsgi-request-logger==0.4.6
zipp==3.4.0