I’m using raven-js
as my client for Sentry.
I’m using it with a small 1-page Electron app (Chromium).
The problem:
- During testing, I intentionally created an error in my app in a file called
race.js
on line 85. - This line number is NOT reported to Sentry!
The evidence:
- The stack trace shows in the browser console window like this:
Uncaught TypeError: Cannot read property 'status' of undefined
(anonymous function) @ D:\Repositories\isaac-racing-client\app\assets\js\ui\race.js:85
dispatch @ jquery.min.js:4
r.handle @ jquery.min.js:4
d @ raven.js:372
trigger @ jquery.min.js:4
trigger @ jquery.min.js:4
(anonymous function) @ jquery.min.js:4
each @ jquery.min.js:2
each @ jquery.min.js:2
trigger @ jquery.min.js:4
m.fn.(anonymous function) @ jquery.min.js:5
hotkey @ D:\Repositories\isaac-racing-client\app\assets\js\keyboard.js:121
emitTwo @ events.js:106
emit @ events.js:191
This is normal and good and expected!
However, what gets reported to Sentry is this (scraped from the dataCallback
function):
[
{
"type": "TypeError",
"value": "Cannot read property 'status' of undefined",
"stacktrace": {
"frames": [
{
"filename": "file:\/\/\/D:\/Repositories\/isaac-racing-client\/app\/assets\/js\/lib\/jquery.min.js",
"lineno": 5,
"colno": 15442,
"function": "m.fn.(anonymous function) [as click]",
"in_app": true
},
{
"filename": "file:\/\/\/D:\/Repositories\/isaac-racing-client\/app\/assets\/js\/lib\/jquery.min.js",
"lineno": 4,
"colno": 15493,
"function": "m.trigger",
"in_app": true
},
{
"filename": "file:\/\/\/D:\/Repositories\/isaac-racing-client\/app\/assets\/js\/lib\/jquery.min.js",
"lineno": 2,
"colno": 835,
"function": "m.each",
"in_app": true
},
{
"filename": "file:\/\/\/D:\/Repositories\/isaac-racing-client\/app\/assets\/js\/lib\/jquery.min.js",
"lineno": 2,
"colno": 2975,
"function": "Function.each",
"in_app": true
},
{
"filename": "file:\/\/\/D:\/Repositories\/isaac-racing-client\/app\/assets\/js\/lib\/jquery.min.js",
"lineno": 4,
"colno": 15517,
"function": "HTMLInputElement.<anonymous>",
"in_app": true
},
{
"filename": "file:\/\/\/D:\/Repositories\/isaac-racing-client\/app\/assets\/js\/lib\/jquery.min.js",
"lineno": 4,
"colno": 7307,
"function": "Object.trigger",
"in_app": true
},
{
"filename": "file:\/\/\/D:\/Repositories\/isaac-racing-client\/app\/assets\/js\/lib\/jquery.min.js",
"lineno": 4,
"colno": 10804,
"function": "HTMLInputElement.trigger",
"in_app": true
},
{
"filename": "https:\/\/cdn.ravenjs.com\/3.9.1\/raven.min.js",
"lineno": 2,
"colno": 6222,
"function": "HTMLInputElement.d",
"in_app": false
},
{
"filename": "file:\/\/\/D:\/Repositories\/isaac-racing-client\/app\/assets\/js\/lib\/jquery.min.js",
"lineno": 4,
"colno": 5252,
"function": "HTMLInputElement.r.handle",
"in_app": true
},
{
"filename": "file:\/\/\/D:\/Repositories\/isaac-racing-client\/app\/assets\/js\/lib\/jquery.min.js",
"lineno": 4,
"colno": 8549,
"function": "HTMLInputElement.dispatch",
"in_app": true
}
]
}
}
]
As you can see, the stack trace does not contain the FINAL frame/entry about race.js:85
(which happens to be the only one that I care about).
At first, I thought that it was truncating the stack frames to 10. But that isn’t so - it’s chopping off the 3 frames at the bottom AND the 1 frame at the top.
What’s going on? I looked in the “Configure” section of the Sentry.js docs, but I didn’t see anything about configuring the size of the stack frames.