Using sentry-electron with contextIsolation, preload.js, and nodeIntegration off
See original GitHub issueHi there!
I’m trying to get errors from renderer.js
, where I can’t require/import anything because I have nodeIntegration turned off for security reasons.
I looked at your sample app, but even initializing sentry in the preload.js
, I’m still not able to get exceptions from renderer.js
. I test this by trying to run a non-existent function in renderer.js
, similar to the example you have in the docs.
This is probably a noob-level misunderstanding, but I can’t figure out what I’m supposed to do here, despite reading through a number of issues like this one.
I’m happy to share code, but I’d love an example of exactly what I need to put in renderer.js
, preload.js
, and main.js/index.js
to make this work.
Thank you for making sentry-electron!
Jimmy
Issue Analytics
- State:
- Created 2 years ago
- Comments:10
Top Results From Across the Web
Communication between preload and client given context ...
In Electron 5.0.0, context isolation will be enabled by default. To prepare for this change, set {contextIsolation: false} in the webPreferences ...
Read more >Context Isolation - Electron
Context Isolation is a feature that ensures that both your preload scripts and Electron's internal logic run in a separate context to the...
Read more >require is not available in "Electron Isolated Context ... - GitHub
As I mentioned, require is available to the preload script when {contextIsolation: true, nodeIntegration: false} and AFAICT that's deliberate.
Read more >How to Secure a Electron App Using Context Isolation.NO ...
Today we will make our app secure using context isolation inside electron 12. This is a very important topic to developing electron apps...
Read more >Preloading Insecurity In Your Electron - YouTube
Even without a framework bug (e.g. nodeIntegration bypass), BrowserWindow preload introduces a new interesting attack surface to ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
With 3.0.0-beta.1, here is an example in the integration test examples: https://github.com/getsentry/sentry-electron/tree/master/examples/webpack-context-isolation
If you can wait a few days 3.0.0-beta.2 should remove the need for a preload unless you’re bundling the main process code and using Electron < v5: https://github.com/getsentry/sentry-electron/pull/377
Yes. Unless you bundle your renderer code, you will not be able to use any dependencies in the renderer process with
nodeIntegration: false
.