Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is " finished with status: 'crash' " normal for Cloud Functions?

I tried Google Cloud Functions with Python and there was a problem with running it. It said: Error: could not handle the request

I checked the logs, but there was no error, just a log message:

Function execution took 16 ms, finished with status: 'crash'

When I simplified the function to a printout then it worked properly. Then I added raise Exception('test') before the printout to see if the exception is going to Stackdriver Errors, but it didn't, I got the finished with status: 'crash' message again only in the log.

Is this normal behavior? Or is it a bug and instead of crash I should see the exception as an error in the log?

like image 416
Tom Avatar asked May 24 '20 14:05

Tom


3 Answers

Quite rightly, as alluded to in the Comments, the crash seems buggy about Google Cloud Functions with Python. The issue was reported to the Internal Google Cloud Functions engineers and evaluation is still ongoing. You can monitor this link for fixes

like image 71
oakinlaja Avatar answered Oct 07 '22 13:10

oakinlaja


In my case, I was using code like this:

await Promise.all([
   Promise1,
   Promise2,
   Promise3
]);

Here Promise2 is uploading a file in google bucket but I mistakenly have put dev-gcp.json in .gitignore which ignoring dev-gcp.json(google application credential) on deploying function. This makes an error on google bucket storage when it not able to find dev-gcp.json for authentication. So make sure whatever in the promise is handled properly because some errors are not expected and are not handled.

like image 42
Himanshu Joshi Avatar answered Oct 07 '22 13:10

Himanshu Joshi


def wrapper(request):
    try:
        your_main_gcf(request)
    except Exception as e:
        print(e)

Also, mark 'wrapper' as function to execute in settings for GCF

like image 28
Iurii Aleev Avatar answered Oct 07 '22 11:10

Iurii Aleev