'How to Debug Cloud Function? functions.logger.log not Working

When user update chat/{id} documents, this function will execute.

const functions = require("firebase-functions");

exports.onChangedChat = functions.firestore
.document('chat/{id}')
.onWrite((change, context) => {
    functions.logger.log("START!!!");
    
    ... some code ...
});

However, the function ends with error. So now I'm trying to find the cause of the error but functions.logger.log isn't displayed in Firebase Console.

About above example. When the function is called, Log "START!!!" should displayed. Just shows me like below:

onChangedChat: Function execution started

onChangedChat: Function execution took 16 ms. Finished with status: error

Where is "START!!!"?



Solution 1:[1]

If errors occurs, all logs won't displayed. After commented out ... some code ..., functions.logger.log() worked.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 yuki yuki