while testing my functions I get a view errors. I catch these error with a simple try catch like this of example
export default functions.firestore
.document("deletions/{userUid}/Childlikes/{commentID}")
.onDelete(async (snap, context) => {
try {
....
} catch (err) {
console.log("Error is happened", err);
return;
}
});
This works great. But for viewing the error I have to go to firebase console and check every line of log or im wrong? If soo I be happy to get a better solution for that. For example when you got to firebase console, theres a section at the header which is called "Status" it will be great if every errors are visible there and I could easily check if theres a error or not. And not go trough every log for my function.
CodePudding user response:
You might want to try using Firebase Functions Logger. With this, you can filter the logs in the firebase console to just errors. Also, if you didn't catch the error, it would show up there and be filterable. The features you are asking for don't exist because you are suppressing them.
Instead of
console.log("Error is happened", err);
Try
functions.logger.error(err)
Do read the firebase documentation. There is a lot of great info there.
CodePudding user response:
It sounds like you have a feature request. That should go to Firebase support. Stack Overflow can't help with functionality that doesn't exist.
What does exist are two ways to view your logs. The first one is the one you know in the Firebase console (or the Google Cloud console). The second one is using the Firebase CLI using the command firebase functions:log. I suggest reading the documentation to understand all of your options fully.
