Skip to content

Electron preload fails to load after upgrading to 4.2.0 #637

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
3 tasks done
valenvb opened this issue Feb 3, 2023 · 9 comments
Closed
3 tasks done

Electron preload fails to load after upgrading to 4.2.0 #637

valenvb opened this issue Feb 3, 2023 · 9 comments

Comments

@valenvb
Copy link

valenvb commented Feb 3, 2023

Is there an existing issue for this?

How do you use Sentry?

Self-hosted/on-premise

Electron SDK Version

4.2.0

Electron Version

19.1.9

What platform are you using?

None

Link to Sentry event

No response

Steps to Reproduce

After upgrading @sentry/electron from 4.2.1 to 4.2.0, nothing loads into the Electron BrowserWindows (they are white rectangles).

Devtools indicates an issue loading preload scripts because it can't find the rrweb module required by @sentry/replay.

Expected Result

Electron preloads (and Sentry) load.

Actual Result

Renderer process console output:

Unable to load preload script: path/to/app/resources/app.asar/build/preload/preload.js

Error: Cannot find module './node_modules/rrweb/es/rrweb/packages/rrweb/src/entries/all.js'
Require stack:
- path/to/app/resources/app.asar/node_modules/@sentry/replay/cjs/replay.js
- path/to/app/resources/app.asar/node_modules/@sentry/replay/cjs/integration.js
- path/to/app/resources/app.asar/node_modules/@sentry/replay/cjs/index.js
- path/to/app/resources/app.asar/node_modules/@sentry/browser/cjs/index.js
- path/to/app/resources/app.asar/node_modules/@sentry/electron/renderer/index.js
- path/to/app/resources/app.asar/build/preload/preload.js
    at Module._resolveFilename (VM97 loader:940:15)
    at i._resolveFilename (VM119 renderer_init:33:1095)
    at Module._load (VM97 loader:785:27)
    at c._load (VM116 asar_bundle:5:13343)
    at i._load (VM119 renderer_init:33:356)
    at Module.require (VM97 loader:1012:19)
    at require (VM96 helpers:102:18)
    at Object.<anonymous> (VM207 replay.js:9:1)
    at Object.<anonymous> (VM207 replay.js:1064:3)
    at Module._compile (VM97 loader:1118:14)
@timfish
Copy link
Collaborator

timfish commented Feb 4, 2023

Thank you for reporting this. It sounds related to a recent change in dependencies for the session reply features but this wasn't picked up by any of our existing integration tests.

Do you have a simple project that reproduces the above error?

@timfish

This comment was marked as outdated.

@andymartinwork
Copy link

andymartinwork commented Feb 14, 2023

I have the same error. Upgrading from "@sentry/electron": "4.1.0" to "@sentry/electron": "4.2.0" gives this error:

Error: Cannot find module './node_modules/rrweb/es/rrweb/packages/rrweb/src/entries/all.js'

Note - this only happens when the app is packaged with electron-builder. When running locally on dev everything seems to work.

I've only tried on macOS.

@timfish
Copy link
Collaborator

timfish commented Feb 14, 2023

@andymartinwork can you provide more details to help me reproduce this? What version of electron-builder, what command causes the error, etc, etc.

A basic repository demonstrating the issue is most helpful!

@phillipCouto
Copy link

@andymartinwork can you provide more details to help me reproduce this? What version of electron-builder, what command causes the error, etc, etc.

A basic repository demonstrating the issue is most helpful!

This happens with electron-builder 23.6.0. When the application is packaged the rrweb package is not in the node_modules folder within the asar. Not sure but it may be related to the fact that rrweb is a dev dependency for the @sentry/replay package. I can try creating a repository to recreate the issue later if no one else does.

@timfish
Copy link
Collaborator

timfish commented Feb 18, 2023

Thanks @phillipCouto.

I just checked /node_modules/@sentry/replay/cjs/* after updating to the latest JavaScript SDKs and rrweb is now no longer referenced so this should be fixed in the next release of the Electron SDK. If everything goes to plan that will be on Monday!

@phillipCouto
Copy link

Thanks @phillipCouto.

I just checked /node_modules/@sentry/replay/cjs/* after updating to the latest JavaScript SDKs and rrweb is now no longer referenced so this should be fixed in the next release of the Electron SDK. If everything goes to plan that will be on Monday!

Awesome! Looking forward to testing it once it is released. For now I will keep my version at 4.1.2

@timfish
Copy link
Collaborator

timfish commented Feb 20, 2023

v4.3.0 has been released. Let us know if the issue is fixed!

@valenvb
Copy link
Author

valenvb commented Feb 23, 2023

I got pulled into other things at work after reporting this, but thanks all for jumping on this and the fix - v4.3.0 is working great for us!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants