Zappa: A GET request to '/' yielded a 502 response code
I am trying to deploy the first example app with Flask-Ask, It looks like everything works good but after the Deploying API statement I get the following error :
Error: Warning! Status check on the deployed lambda failed. A GET request to ‘/’ yielded a 502 response code.
Context
Here is the code I am executing with minor changes to the sample app
from flask import Flask from flask_ask import Ask, question, statement, session import pyodbc
app = Flask(name) ask = Ask(app, ‘/’)
@ask.intent(‘HelloIntent’) def hello(firstname): speech_text = “Hello %s” % firstname return statement(speech_text).simple_card(‘Hello’, speech_text)
@ask.intent(‘ByeIntent’) def bye(): return statement(“Ok, goodBye!”)
@ask.intent(‘FarziIntent’) def farzi(): return statement(“This is just a random fact!”)
if name == ‘main’: app.run()
Python 3.6 is the version I am running
Expected Behavior
Ideally it should give me a link I can use to configure as an endpoint
Actual Behavior
Error: Warning! Status check on the deployed lambda failed. A GET request to ‘/’ yielded a 502 response code.
Your Environment
- Zappa version used: 0.46.1
- Operating System and Python version: Windows 7, Python 3.6
- The output of
pip freeze:
aniso8601==1.2.0 argcomplete==1.9.3 asn1crypto==0.24.0 awscli==1.15.39 base58==1.0.0 boto3==1.7.39 botocore==1.10.39 certifi==2018.4.16 cffi==1.11.5 cfn-flip==1.0.3 chardet==3.0.4 click==6.7 colorama==0.3.9 cryptography==2.2.2 docutils==0.14 durationpy==0.5 Flask==0.12.1 Flask-Ask==0.9.8 future==0.16.0 hjson==3.0.1 idna==2.7 itsdangerous==0.24 Jinja2==2.10 jmespath==0.9.3 kappa==0.6.0 lambda-packages==0.20.0 MarkupSafe==1.0 placebo==0.8.1 pyasn1==0.4.3 pycparser==2.18 pyOpenSSL==17.0.0 python-dateutil==2.6.1 python-slugify==1.2.4 PyYAML==3.12 requests==2.19.1 rsa==3.4.2 s3transfer==0.1.13 six==1.11.0 toml==0.9.4 tqdm==4.19.1 troposphere==2.3.0 Unidecode==1.0.22 urllib3==1.23 Werkzeug==0.14.1 wsgi-request-logger==0.4.6 zappa==0.46.1
- Link to your project (optional):
- Your
zappa_settings.py:
{ “testdev”: { “app_function”: “app.app”, “profile_name”: null, “project_name”: “basic”, “runtime”: “python3.6”, “s3_bucket”: “zappa-vb8m8hwzy”, “aws_region”: “us-east-1”, “api_key_required”: false, “api_key”:“MY_KEY” } }
Could someone please help me out here?
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 24
- Comments: 41 (2 by maintainers)
First time Zappa user on MacOS. I get the same error. No idea how to proceed.
Edit:
zappa tailhung after dumping some meaningless errors. But doing aMade the latter command go trough and revealed a missing dependency as the reason for the error. Installing that via
pipmade everything work as expected.Sorry about the n00b noise.
I fixed this issue by doing
pip uninstall zappaand thenpip install zappa==0.45.1hope it helps 😉
EDIT: for version 0.45.1, you might also need to apply this patch! 😃
https://github.com/Miserlou/Zappa/pull/1479/files
Like @egyping , I fixed this by downgrading from Django 2.2 to Django 2.1
I have experienced the same issue twice today, re-deploying using
zappa updateworked the second time if it had failed the first time. I do not know why, just getting started. Maybe du to .pyc files as stated previously.Regardless, would be nice to fix this, it feels like it could break anytime when deploying for no particular reason and reduces the confidence in the framework.
Looks like the issue is with my pyodbc library. I get an error saying :
pyodbc.Error: (‘01000’, “[01000] [unixODBC][Driver Manager]Can’t open lib ‘ODBC Driver 11 for SQL Server’ : file not found (0) (SQLDriverConnect)”)
Not sure what to do about that, it is working when I run the code on my local
check this https://stackoverflow.com/a/60014463/7242275
i downgraded to django 2.1 after undeploy, then i deployed it again it worked … very strange!
Hi everyone, i was fighting with same problem and solution for me was remove cache files, you could use this command: find . -name *.pyc -delete. I reproduce the error using several version of Flask, Zappa and PIP and the error in all cases was related with cache,btw there are more problem using zappa=0.47.1 and pip 19, so if possible use zappa 0.45.1 and pip 9.0.1. I hope that it works for you.
@wawhal This certainly works if you remove your
main.appfile. When you changed theapp_functiontomain.app, it made Zappa look inmain.pyand use theappobject in there.Was anyone able to get this running for pyodbc? everytime I deploy I keep getting: No module named ‘pyodbc’: ModuleNotFoundError
For me, setting runtime to python2.7 instead of python3.6 was what solved it.
For me it was an incompatibility between zappa==0.46.1 and Flask==1.0.2 when I downgraded Flask==0.12.2 all worked as expected. Does Zappa officially support Flask 1.0.2?