preload script must have absolute path
See original GitHub issueVersions + Platform
- SDK version -
@sentry/electron@v3.0.7
- Electron version -
electron@v18.2.0
- Platform -
macOS
Description
There are lots of error messages coming from the main process:
[22375:0526/171429.459534:ERROR:session_preferences.cc(38)] preload script must have absolute path: ../../common/temp/node_modules/.pnpm/@sentry+electron@3.0.7/node_modules/@sentry/electron/esm/preload/index.js
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:8
Top Results From Across the Web
preload script not loaded in packaged app - Stack Overflow
Preload script needs to be specified as an absolute path. Thus it will differ from the time you're running it in development versus...
Read more >Electron Adventures: Episode 10: Preload Script
For some reason Electron really wants preload path to be absolute path ... In the frontend script, we just need to change two...
Read more >Migrating to v3 · Issue #370 · getsentry/sentry-electron - GitHub
preload script must have absolute path : ./node_modules/@sentry/electron/esm/preload/index.js. I'm on Electron: 15.2.0 and using ...
Read more >Unable to require path and fs modules in preload script - Reddit
I have been trying to resolve this issue for the last 3 hours and am unable to make any progress. The preload script...
Read more >Using Preload Scripts - Electron
In this part of the tutorial, you will learn what a preload script is and how to use one to securely expose privileged...
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
Ah, so it looks like webpack does replace these with relative strings!
It would be nice to fix this regardless of webpack config.
Because the main process is bundled, these files will not exist and the SDK will fall back to using a custom protocol so you can avoid this for now by setting the
IPCMode
manually: https://github.com/getsentry/sentry-electron/blob/00e7a4608e452d4447cc50cadef682af6cda6e28/test/e2e/test-apps/javascript/renderer-error-protocol/src/main.js#L9We could convert the relative path to absolute, but because the file does not exist it will result in unnecessary file system access.
Interesting, I will poke around to see if something can be done on the webpack config side. FYI, tere’s what my webpack bundle looks like with the relative paths: