Reputation: 149
I have a strange situation when I deploy a python flask based service on GCP cloud-run.
I have some bug in my code that results in a crash as a part of processing some web API. But GCP cloud-run logs don't show anything except just a 500 error message. The same code, when I deploy locally on my machine throws a proper exception with the line number and other details. How do I get GCP cloud-run logs to show all that? All other logs from my code (other print statements, logger output, etc.) shows reliably. It is just these python exceptions that dont show up - making it impossible to troubleshoot issues that happen in production.
I am attaching an image that shows GCP logger output. You see the 500 error there but nothing about where i my code the exception happened and such.
Upvotes: 2
Views: 598
Reputation: 149
In my Dockerfile, I had to replace the first line with the 2nd line for it to work. I still have not found an explanation for it. But I am happy to have made the change - debugging is much easier - especially for long-lived application where one does not always have the luxury to instrument code reproduce problems that happen unexpectedly.
CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 --timeout 0 my_main:app
CMD [ "python", "-u", "my_main.py"]
Upvotes: 0
Reputation: 2065
Posting this as a community wiki as @sachinsdesai mentioned that the issue occurred when using gunicorn
when building and deploying the Cloud Run instance.
Upvotes: 0