How can you see the stack trace of an uncaught exception in Google Cloud Functions?

Viewed 816

I have defined a python function in Google Cloud Functions, which I expect to fail, below:

def write(event, context):
    raise NotImplementedError()

Now I want to look at the stack trace of this function so I can debug my function. In the documentation it states:

Uncaught exceptions produced by your function will appear in Stackdriver Error Reporting.

however I can't seem to find this stack trace anywhere. I've tried looking at the logs (it just tells me it crashed with no trace) and I've tried looking at the Stackdriver Error Reporting page I can't find it anywhere. Where can I access the uncaught error logs?

Picture of GCF test response for reference.

Thanks for any help!

3 Answers

If I open the "Function Details" view of my function on GCP and then click the "View Logs" button on the top button bar (next to edit, delete, copy) I am thrown into the logs viewer under Operations (which used to be Stackdriver I guess). I can see everything that my functions outputs there (this one was in Node.js).

A neat workaround that is suggested in the issuetracking page Dustin provided say changing the python version from 3.7 to 3.8 should temporary do the trick. It has worked for me, although you should keep in mind that 3.8 is currently in Beta.

Related