-
Notifications
You must be signed in to change notification settings - Fork 210
logger.error doesn't show in the "Health" tab anymore #954
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This issue does not have all the information required by the template. Looks like you forgot to fill out some sections. Please update the issue with more information. |
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight. |
Thanks for reporting the issue @larssn. I'm not familiar with how error reporting in the health tabs worked before, but you will need to explicitly include an Error object if you want these error logs to show up in the Health tab or in the GCP Error Reporting. e.g.
Since Node.js 10, Google Cloud Functions does not work very well with Check out https://cloud.google.com/functions/docs/monitoring/error-reporting on examples of what log statement works/does not work with GCP error reporting tool (just replace Let us know if this helps. |
As I wrote, it used to log errors in Health tab when you did a The health tab now seemingly only reports unhandled errors. It can be problematic that your handled errors no longer shows up in the health tab. Imagine having to dig through a huge log file every day to find problems, instead of it being in the health tab. |
@larssn Any recent changes to your function that you are aware of? Any recent version bump to Firebase Functions SDK or update to the nodejs runtime version? I can check to see if there were any deliberate changes that were made in the Health tab, but AFAIK, health tab just fetches data from GCP Error Reporting (https://cloud.google.com/error-reporting), which only reports |
Our NPM versions are updated regularly. However we did switch to the Node 14 runtime, 3-4 months ago I'd say. Thanks for the help! 😊 |
Just to get the timeline correct - when you say "it used to log errors in Health tab... You could log anything" - is this 3-4 months ago or like last week? |
I haven't kept track of when it is used to work like that, but I know it didn't work last week, probably the entire month of August. For all I know it could be the swap to Node 14. |
@larssn That sounds possible. Given the state of things now, I think we can shape our conversation here as a feature request to automatically wrap strings passed into |
Sounds good to me 🙂 |
I'm having the same issue, the documentation states that using:
Will get reported to Only the other two will report the error. |
It's not complete, but I've tried some way. updated // Reported correctly with error message (Errors of the same class are grouped together)
functions.logger.error(new Error('error on logger error'))
console.error(new Error('error on console error'))
throw new Error("handled error");
functions.logger.error(
new MyError(
'error with custom property on logger error',
// my error class just saving it as a property
// and error reporting stringified it and stored in text payload
{ hello: 'world' }
)
)
// Reported correctly. however, the argument is combined with the error message and output as an error message.
functions.logger.error(
'string and error on logger error',
new Error('Bar')
)
functions.logger.error(
{ 'structured data and error on logger error': 123 },
new Error('Bar')
)
// Reported correctly with additional structured data
// https://cloud.google.com/error-reporting/docs/formatting-error-messages
const manualErrorPayload = {
// required for (simplified?) reported
'@type':
'type.googleapis.com/google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent',
severity: 'ERROR',
message: 'manual error',
// can additional structured data (Although it may be illegal data that is not officially permitted)
foo: 'bar',
hey: { yo: 'yeah' },
}
console.error(JSON.stringify(manualErrorPayload))
// Not reported
functions.logger.error('string on logger error')
console.error('string on console error')
console.error('string and error on console error', new Error('Foo'))
throw new functions.https.HttpsError('internal', 'functions https error') |
@ishowta Thanks for a thorough experiment. I'll see if I can grab the attention of our tech writer next week to update our content. In the meantime, I'm curious what version of Nodejs runtime you used to check the output - there seems to be a difference in how error shows up in the Error Dashboard depending on the Nodejs version (12 vs 14 vs 16). |
@taeold I tried it with the Node12 runtime. |
@taeold @Flucadetena Sorry, my test code was wrong, so I fixed it and cleaned it up. Basically, if there is an error instance, it seems to be reported, but in the form |
@ishowta so what is the best way to log a object with an error stack? |
Hi @SrBrahma Any of the options but, I use: And this is working great for me now. |
Functions Health tab no longer exists :(. Marking the issue as obsolete. |
[REQUIRED] Environment info
Not sure if this is the right place to post this in the myriad of issue trackers. Sorry in advance.
firebase-tools:
9.16.3
Platform:
Node 14
[REQUIRED] Test case
Doing a
logger.error('Something')
no longer shows up in the health tab in the firebase console under Functions->Health.[REQUIRED] Steps to reproduce
import { logger } from 'firebase-functions';
logger.error('Something')
Notice that it doesn't show up in the health tab anymore
[REQUIRED] Expected behavior
That it shows up there - we need to log handled errors to the health tab.
[REQUIRED] Actual behavior
It never shows up
The text was updated successfully, but these errors were encountered: