Uh oh!
There was an error while loading. Please reload this page.
Feat: Allow node stackwalk in Electron renderer - #3710
Conversation
timfish
commented
Jun 20, 2021
I've also got a branch that uses |
kamilogorek
left a comment
There was a problem hiding this comment.
Would it maybe be possible to just bail out if fs is not available?
functiontryToReadFile(filename,resolve): void{try{const{ readFile }=require('fs');// move previous logic here}catch(_e){returnnull;}}Although totally valid, the implementation from this PR adds a lot of indirection which is kinda hard to follow.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This comment has been minimized.
This comment has been minimized.
timfish
commented
Jun 21, 2021
Any usage of |
timfish
commented
Jun 21, 2021
I've refactored this to be a bit better in that rather than passing around a ref to It would still probably be better to refactor the source reading out of So in publiceventFromException(exception: any,hint?: EventHint): PromiseLike<Event>{
const event=eventFromException(this._options,exception,hint);returnaddSourcesToEvent(event);}And in publiceventFromException(exception: any,hint?: EventHint): PromiseLike<Event>{returneventFromException(this._options,exception,hint);}Do you think the unit tests are up to supporting me through that kind of refactor? 🙂 |
timfish
commented
Jun 23, 2021
Closing in favour of #3729 |
Related to: getsentry/sentry-electron#308
This PR:
@sentry/nodefunctionseventFromExceptionandeventFromMessageout of backend and into their own file much like in the browser SDK.@sentry/electronreadFileas a parameter in the parser functionsWhy is this funky
readFilestuff required?The Electron renderer may or may not have access to node functionality. If
nodeIntegrationis enabled, full node is available. IfnodeIntegrationis disabled and a bundler is being used, it will complain thatfscannot be found/is unavailable. With this PR we would just not passreadFilewhen the stack parser is called from the Electron renderer and no source files will be read.What are the alternatives?
@sentry/electrondepending onnodeIntegration(ie.initandinitWithNode)fstoexternalsNodeIntegrationsentry integration that "patches" in this functionality?