Open murphyke opened 5 years ago
It seems that the message
attribute is not recognized as being an exception by Stackdriver Error Reporting.
Stackdriber Error Reporting expects stacktraces formatted as such
Would you mind providing an exact sample that reproduces the issue?
I am cranking for a deadline but will make a reminder to look at this ... hopefully next week.
I have reproduced this in our deployment, issue is not related to calling report directly, but comes from stacktrace-gps
producing invalid function names.
Example response:
{
"error": {
"code": 400,
"message": "ReportedErrorEvent.context must contain a location unless `message` contain an exception or stacktrace.",
"status": "INVALID_ARGUMENT"
}
}
Example message from request:
TypeError: Cannot read property 'removeLayer' of null
at window.setTimeout(function (webpack:///node_modules/prunecluster/dist/PruneCluster.js:938:0)
The section of code from PruneCluster:
window.setTimeout(function () {
for (i = 0, l = markers.length; i < l; ++i) {
_this._map.removeLayer(markers[i]);
}
}, 300);
This would be correctly reported as <anonymous>
but has instead given 'window.setTimeout(function'
as the function name.
Workarounds at the stackdriver-errors-js level are possible, if a bit awkward? Could use something like isVarName to strip out badly detection function names.
See also https://github.com/stacktracejs/stacktrace-gps/issues/54 which is another problem with this part of the JS parsing.
Seeing something similar in 0.8.0:
Payload:
{
"serviceContext":{"service":"web"},
"context":{"httpRequest":{"userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.164 Safari/537.36","url":"https://app.DOMAIN.com/tracks/91"}},
"message":"TypeError: Cannot read property 'querySelectorAll' of null\n at _loadArchivedCards(t){this.store.dispatch(Object(h.g)(this.stage.trackId,{stageId:this.stage.id,archived:!0})).then(()=>{Object(F.a) (https://app.DOMAIN.com/6.49bfb0b2404f25c0f4e0.bundle.js:515:1420)"
}
Response:
{
"error": {
"code": 400,
"message": "ReportedErrorEvent.context must contain a location unless `message` contain an exception or stacktrace.",
"status": "INVALID_ARGUMENT"
}
}
Hi, I have code that does:
but the stackdriver API response is:
The request that is sent to stackdriver is:
What is the recommendation? Do I have to annotate the error object somehow?
Unhandled exceptions are reported correctly.
Using Chrome, btw.