Google App Engine – How to Troubleshoot 500 Internal Server Error

google-app-enginegoogle-cloud-platform

Is there any way to properly troubleshoot GAE 500 server errors? I know I can check from console.developers.google.com -> Monitoring -> logs, but they do not tell much. Only same thing that I can get from the browser network response 500 internal server error.

What I am looking for is the similar log to apache.log or php.log that would actually print a stacktrace of an error or an exception that happened in app.

Best Answer

The previous answers are out of date now (some three years later). Look for the Error Reporting panel in the google cloud platform dashboard.

You will get a stack trace to the problem in your code (if the problem is in your code and I suppose you probably need to be logging errors to std err). A stack trace should help you debug a 500 error. Here's a stack trace that I just received ...

ImportError: No module named flask_assistant

at <module> (/base/data/home/apps/f~XXXX/20180209t180735.407529010683953771/main.py:31)
at LoadObject (/base/alloc/tmpfs/dynamic_runtimes/python27/a7637d5531ec9deb_unzipped/python27_lib/versions/1/google/appengine/runtime/wsgi.py:85)
at _LoadHandler (/base/alloc/tmpfs/dynamic_runtimes/python27/a7637d5531ec9deb_unzipped/python27_lib/versions/1/google/appengine/runtime/wsgi.py:299)
at Handle (/base/alloc/tmpfs/dynamic_runtimes/python27/a7637d5531ec9deb_unzipped/python27_lib/versions/1/google/appengine/runtime/wsgi.py:240)

That's how to get a stack trace in the event of a 500 error.

Related Topic