6
votes

enter image description hereI saw the following error in Cloud Function logs:

Error: function terminated. Recommended action: inspect logs for termination reason. Function invocation was interrupted.

But I'm not getting any logs in Stackdriver or in Cloud Functions for Firebase logs.

1
"Saw this logs in cloud function" -> where exactly? Are you using the emulator? Or it is a Cloud Function you have deployed? - Renaud Tarnec
Welcome to Stackoverflow. Are you using Google Cloud Functions or Cloud Functions for Firebase? Does this incident happen when the function gets deployed? In order to help you, please introduce your issue and include just enough code to allow others to reproduce your issue. You can read more about how to ask questions on Stackoverflow here - sllopis
I'm using firebase cloud functions, actually i'm not able to found logs for "for termination reason". I attached screenshot as well. @Renaud Tarnec - deepak gaur
What does your Firebase Cloud Function look like? When did you notice this error? What kind of operation were you executing? More information is needed to be able to help you further. - sllopis
I am also getting this error. The function executes fine via the emulator in development, but not after a deployment to production. I tried by upgrading from a Free plan to Pay as you go. But the issue is still present. I would like to know how to inspect the log for firebase functions as mentioned? The logs section does not show enough details: console.firebase.google.com/u/1/project/PROJECT/functions/logs - ipegasus

1 Answers

0
votes

When looking at stackdriver make sure to enable all logs at the filter or use this advanced filter:

resource.type="cloud_function"
resource.labels.function_name="<function_name>"
resource.labels.region="<function_region>"

Uncaught exceptions produced by your function will appear in Stackdriver Error Reporting, but if they don't try adding a catch clause and manually write it to stdout

If for some reason you find an error that is not being logged to stackdriver you can reach out to GCP support so they can check if additional logging is available at the particular function termination occurrence.