question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error when deploying API Gateway: A GET request to '/' yielded a 502 response code.

See original GitHub issue

I’m trying to deploy to AWS for the first time using Zappa. I have a Django API running in a virtual environment I created using virtualenvwrapper.

When I ran zappa deploy and now when I run zappa update, it seems to go okay - it downloads and installs dependencies, zips the project, uploads it, uploads the Lambda code and then tries to deploy the API Gateway. That’s when it fails and I get the following: Unscheduled chatroomserver-dev-zappa-keep-warm-handler.keep_warm_callback. Scheduled chatroomserver-dev-zappa-keep-warm-handler.keep_warm_callback with expression rate(4 minutes)! Error: Warning! Status check on the deployed lambda failed. A GET request to '/' yielded a 502 response code.

It’s a super simple chat API, I pushed it here: https://github.com/michaloslav/Chatroom-Backend (I didn’t push ChatroomServer/settings.py because it includes databases access information so if you try to run it, it won’t work)

Environment: Zappa version: 0.48.2 Win 10, Python 3.7 Pip freeze output: argcomplete==1.9.3 astroid==2.2.5 base58==0.2.4 boto3==1.9.185 botocore==1.12.185 certifi==2019.6.16 cfn-flip==1.2.1 chardet==3.0.4 Click==7.0 colorama==0.4.1 dataclasses==0.6 Django==2.2.3 django-cors-headers==3.0.2 django-filter==2.1.0 django-mongodb-engine==0.6.0 djangorestframework==3.9.4 djongo==1.2.33 docutils==0.14 durationpy==0.5 future==0.16.0 handler==1.3.0 hjson==3.0.1 idna==2.8 isort==4.3.21 jmespath==0.9.3 kappa==0.6.0 lambda-packages==0.20.0 lazy-object-proxy==1.4.1 Markdown==3.1.1 mccabe==0.6.1 placebo==0.9.0 pylint==2.3.1 pymongo==3.8.0 python-dateutil==2.6.1 python-slugify==1.2.4 pytz==2019.1 PyYAML==5.1.1 requests==2.22.0 s3transfer==0.2.1 six==1.12.0 sqlparse==0.2.4 toml==0.10.0 tqdm==4.19.1 troposphere==2.4.9 typed-ast==1.4.0 Unidecode==1.1.1 urllib3==1.25.3 Werkzeug==0.15.4 wrapt==1.11.2 wsgi-request-logger==0.4.6 zappa==0.48.2

zappa_settings.json: { "dev": { "aws_region": "us-east-2", "django_settings": "ChatroomServer.settings", "profile_name": "default", "project_name": "chatroomserver", "runtime": "python3.7", "s3_bucket": "michaloslav-chatroom", "extra_permissions": [{ "Effect": "Allow", "Action": ["rekognition:*"], "Resource": "*" }] } }

I already saw some people having similar issues and there seem to be 2 potential solutions:

  1. Running zappa tail and installing any missing dependencies. I tried that and got the following: 1562750236050] [ERROR] Runtime.ImportModuleError: Unable to import module 'handler': No module named 'werkzeug [1562753064340] [ERROR] Runtime.HandlerNotFound: Handler 'lambda_handler' missing on module 'handler' (both of these occured multiple times and there was also some other stuff but it doesn’t seem relevant)

So I pip installed handler, tried upgrading werkzeug which was already up to date and tried installing lambda_handler which doesn’t exist. I tried zappa update again after that and still got the same result 2) Downgrading Zappa to 0.45.1. I tried that but it doesn’t support Python 3.7. If necessary, I could downgrade to Python 3.6, the code should still work. I’m not really sure how that would work though and there should be a way to get it to work without downgrading.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:7
  • Comments:24 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
michaloslavcommented, Jul 10, 2019

Sorry about the late reply. The logs are basically these lines all over again and again.

START RequestId: 41f30055-88aa-4be2-af60-eaa13b5ef45d Version: $LATEST

[ERROR] Runtime.HandlerNotFound: Handler 'lambda_handler' missing on module 'handler'

END RequestId: 41f30055-88aa-4be2-af60-eaa13b5ef45d

REPORT RequestId: 41f30055-88aa-4be2-af60-eaa13b5ef45d Duration: 1.47 ms Billed Duration: 100 ms Memory Size: 512 MB Max Memory Used: 53 MB

(The RequestId changes with every request)

It really looks like the lambda_handler thing might be the problem but I have no idea how to fix that. I already installed handler and it’s up to date

0reactions
Ronster2018commented, May 7, 2020

After investigating the tail output, I noticed that an exception was being raised. It was relating to the sqlite version that I had installed. The exception that was thrown was early on and it looks like this is what was causing my issue. After implementing the fix, Zappa began to work for me! The work around can be found here under a different issue for this project.

I hope this helps!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Warning! Status check on the deployed lambda failed. A GET ...
Deploying API Gateway.. Error: Warning! Status check on the deployed lambda failed. A GET request to '/' yielded a 500 response code.
Read more >
Zappa deployment error : GET request yields 502 response ...
A GET request to '/' yielded a 502 response code. Here is the code I am executing with minor changes to the sample...
Read more >
How do I resolve HTTP 502 errors from API Gateway REST ...
I configured Amazon API Gateway proxy integration to work with an AWS ... API, I receive a configuration error and an HTTP 502...
Read more >
3 years, 5 months ago - codingforentrepreneurs.com
hello @jmitchel3 i am also getting this eooro "Deploying API Gateway.. Error: Warning! Status check on the deployed lambda failed. A GET request...
Read more >
A GET request to '/' yielded a 502 response code - Bountysource
I am trying to deploy the first example app with Flask-Ask, It looks like everything works good but after the Deploying API statement...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found