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?
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
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With