I infrequently see this error in my Firebase Cloud Functions logs:
"Error: function terminated. Recommended action: inspect logs for termination reason. Additional troubleshooting documentation can be found at https://cloud.google.com/functions/docs/troubleshooting#logging Request rejected.".
I looked through the logs around the time this error occurred and don't see any other information, just a few other successful executions of the same cloud function. The same function is executing successfully thousands of times a day, but then once every day or few hours this is shown. My entire cloud function body is wrapped in a try/catch and I've seen logical errors reported properly from the error log in the catch code so I don't know how this uncaught error is happening or how to get any more information about it. Does anyone know how this error could be happening? This is a sanitized version of the function throwing this weird error:
exports.onUserDocUpdate = functions.firestore
.document('user/{userId}/{collectionId}/{docId}')
.onWrite(handleDocumentWrite);
async function handleDocumentWrite(change, context) {
try {
// Function logic here
} catch (error) {
functions.logger.error(`firestoreTriggers.handleDocumentWrite failed with error:`, error);
}
}