I've been making intel builds of our Electron app with Electron-Builder for a while, signing them, and being able to run them without issue.
I'm now trying to make an M1/arm build, but it turns out that signing that build causes the renderer to crash. Not signing the build doesn't cause the crash. This isn't an issue for the intel build. (consistent whether build machine is intel or arm, and whether notarize is called subsequently or not)
I see the following during app startup (Note specifically the v8 fatal error at the top, which is the main concern here):
[...]
<--- Last few GCs --->
<--- JS stacktrace --->
[22739:0331/171516.826773:FATAL:v8_initializer.cc(820)]
render-process-gone { reason: 'crashed', exitCode: 5 }
[...]
Error sending from webFrameMain: Error: Render frame was disposed before WebFrameMain could be accessed
at EventEmitter.n.send (node:electron/js2c/browser_init:169:417)
at EventEmitter.b.send (node:electron/js2c/browser_init:165:2494)
at c.<anonymous> (/Users/armelchesnais/Documents/Rave/desktop/dist/mac-arm64/Rave-blue.app/Contents/Resources/app/main.prod.js:2:587569)
at c.emit (node:events:390:28)
at c.emit (node:domain:475:12)
at c.doCheckForUpdates (/Users/armelchesnais/Documents/Rave/desktop/dist/mac-arm64/Rave-blue.app/Contents/Resources/app/main.prod.js:2:993643)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at w.retries (/Users/armelchesnais/Documents/Rave/desktop/dist/mac-arm64/Rave-blue.app/Contents/Resources/app/main.prod.js:2:588005)
Error sending from webFrameMain: Error: Render frame was disposed before WebFrameMain could be accessed
at EventEmitter.n.send (node:electron/js2c/browser_init:169:417)
at EventEmitter.b.send (node:electron/js2c/browser_init:165:2494)
at BrowserWindow.<anonymous> (/Users/armelchesnais/Documents/Rave/desktop/dist/mac-arm64/Rave-blue.app/Contents/Resources/app/main.prod.js:2:632050)
at BrowserWindow.emit (node:events:390:28)
at BrowserWindow.emit (node:domain:475:12)
I won't be able to distribute the arm/M1 build of the app as a result from this. I'm at a loss as to how signing would affect a crash of the renderer only on one architecture.
How do I resolve this?
I don't know with certainty that we're experiencing the same issue as you, but the following steps fixed an issue like this for our users.
In our case it was caused by native dependencies. The .node files of native dependencies are treated as separate executables which are expected to be signed under normal circumstances. The sandboxing that occurs when they're not seems only to occur on machines with the new M1 chips.
I'm not certain that all of these changes are necessary because we don't have a machine with an M1 chip. I'll update this answer as I whittle it down, but that may take a while given our lack of hardware.
Here's the three changes we've implemented, based on my research:
entitlements.plist has at minimum the following. Also ensure you replicate the properties of the default plist for electron-notarize if you use it. <dict>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
</dict>
Source
Specify your entitlements file for both entitlements and entitlementsInherit (See docs)
Add the following for asarUnpack
asarUnpack: ['**/*.node']
Please do let me know if this helped!
This was the exact scenario I was facing. I fixed it by updating my entitlements.plist to
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.allow-jit</key>
<true/>
</dict>
</plist>
I was missing com.apple.security.cs.allow-jit
More details about it is here https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_security_cs_allow-jit
It is documented in the prerequisites
https://github.com/electron/notarize#prerequisites
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With