stackdriver-errors-js
stackdriver-errors-js copied to clipboard
Cannot set property onunhandledrejection of [object Object] which has only a getter
This may have birthed from Issue#35.
I'm seeing logs with the following error:
TypeError: Cannot set property onunhandledrejection of [object Object] which has only a getter
at onunhandledrejection (../node_modules/stackdriver-errors-js/stackdriver-errors.js:91:0)
at window.addEventListener (index.js:133:15)
This is happening on my starting the ErrorReporter. index.js:133 is line 3:
window.addEventListener('DOMContentLoaded', function () {
var errorHandler = new StackdriverErrorReporter();
errorHandler.start({
targetUrl: '<my_url>',
});
})
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36
Thanks for the report. Do you confirm you are using the module at HEAD?
I just installed from npm, so it's the 0.5.0 release.
Should I wait for a minor release or just start using HEAD?
I did a bit of digging. It seems I was rejecting a promise with a string, which caused this section to generate an error to report. So the stack starts at this point.
Unfortunately the stack traces cross async-boundaries on these Promises, so they not particularly useful.
Unless you guys can figure out how to get the full stacktrace, perhaps it would be more useful to not have a StackTrace rather than a partial & internal one.
Version 0.5.0
is supposed to work.
Would you be able to provide a minimal sample (e.g. on codepen) that reproduces the issue?
hmmm. was trying this, ran into another issue. The CDN ( https://cdn.jsdelivr.net/npm/[email protected]/dist/ ) doesn't even have a window.onunhandledrejection
A messup on publishing to CDN?
Can't seem to repro this right now ( https://codepen.io/navpatel/pen/LqYZKq ). Will try to dig up how this happened on my end and figure it out.