An unhandled rejection has occurred inside Forge
Pre-flight checklist
- [X] I have read the contribution documentation for this project.
- [X] I agree to follow the code of conduct that this project uses.
- [X] I have searched the issue tracker for a bug that matches the one I want to file, without success.
Electron Forge version
6.4.2
Electron version
26.3.0
Operating system
macOS 13.5
Last known working Electron Forge version
No response
Expected behavior
App should be successfully packaged, signed and stapled,
Actual behavior
An unhandled rejection has occurred inside Forge:
Error: Failed to staple your application with code: 66
Processing: /private/var/folders/zk/0mmxhpss3gsd8_hp4lgmj7r40000gn/T/electron-packager/darwin-x64/Favia-darwin-x64-7FnNqx/Favia.app
Properties are {
NSURLIsDirectoryKey = 1;
NSURLIsPackageKey = 1;
NSURLIsSymbolicLinkKey = 0;
NSURLLocalizedTypeDescriptionKey = Application;
NSURLTypeIdentifierKey = "com.apple.application-bundle";
"_NSURLIsApplicationKey" = 1;
}
Props are {
}
Cannot download ticket. CDHash must be set.
at /Users/alex/Projects/favia/desktop/node_modules/@electron/notarize/src/staple.ts:16:11
at Generator.next (<anonymous>)
at fulfilled (/Users/alex/Projects/favia/desktop/node_modules/@electron/notarize/lib/staple.js:4:58)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
error Command failed with exit code 1.
Steps to reproduce
I have a basic config in my forge.config.ts
osxSign: {
},
osxNotarize: {
tool: "notarytool",
appleId: process.env.APPLE_ID,
appleIdPassword: process.env.APPLE_ID_PASSWORD,
teamId: process.env.APPLE_TEAM_ID,
},
when I run yarn make which calls electron-forge make I get the error.
Additional information
forge.config.ts
const config: ForgeConfig = {
packagerConfig: {
asar: true,
icon: "./icons/icon.icns",
osxSign: {}, // object must exist even if empty
osxNotarize: {
tool: "notarytool",
appleId: process.env.APPLE_ID,
appleIdPassword: process.env.APPLE_ID_PASSWORD,
teamId: process.env.APPLE_TEAM_ID,
},
},
rebuildConfig: {},
makers: [
{
name: "@electron-forge/maker-dmg",
config: {
name: "Favia",
icon: "./icons/icon.icns",
format: "ULFO",
overwrite: true,
},
},
new MakerSquirrel({}),
new MakerRpm({}),
new MakerDeb({}),
],
plugins: [...]
}
Same issue
I know it's not necessarily helpful to have a bunch of people +1ing an issue, but I'm getting this, too and would really appreciate a fix. Running the same setup as above, but I'm on macOS 14.1.1 and running Electron 27.0.4.
Got rid of this error by updating Node version. Running it on 21.1.x solved it for me.
Damn, that didn't do it for me. Even tried both Node v21.2.0 and going back to Electron 26.3.0. Also still happens in my GH Actions. Sorrow.
Both Node v20.9.0 and v21.1.0 not work for me
The Forge 7.0 update fixed this for me! 🎉
Is there any new progress on this issue?
@TinsFox The problem is related to the certificate. I created a file CertificateSigningRequest.certSigningRequest and saved it to my drive. Then I created a Developer ID Application certificate, saved the new certificate then built again and it worked for me.
You can use the command security find-identity -p codesigning -v to check the certificate is valid, Developer ID Application is required in this list.
forge.config.js
module.exports = {
packagerConfig: {
asar: true,
icon: './images/icon',
osxSign: {
identity: 'Developer ID Application: *** JOINT STOCK COMPANY (XXXXXXXXXX)', // important
'hardenedRuntime': true,
'gatekeeperAssess': false,
'entitlements': './mac/entitlements.mac.plist',
'entitlementsInherit': './mac/entitlements.mac.plist',
},
osxNotarize: {
tool: 'notarytool',
appleApiKey: process.APPLE_API_KEY,
appleApiKeyId: process.APPLE_API_KEY_ID,
appleApiIssuer: process.APPLE_API_ISSUER,
},
},
...
...
}
entitlements.mac.plist
<?xml version="1.0" encoding="UTF-8"?>
<!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-jit</key>
<true/>
<key>com.apple.security.device.audio-input</key>
<true/>
<key>com.apple.security.device.bluetooth</key>
<true/>
<key>com.apple.security.device.camera</key>
<true/>
<key>com.apple.security.device.print</key>
<true/>
<key>com.apple.security.device.usb</key>
<true/>
<key>com.apple.security.personal-information.location</key>
<true/>
</dict>
</plist>
@tinhnvc-gadget Thank you for your reply, but I don't have the configuration related to signature at present
@TinsFox Code-signing is required before the app can be installed on another MacOS device.
If you have not configured signatures, you will need to remove osxSign and osxNotarize fields.
@TinsFox Code-signing is required before the app can be installed on another MacOS device. If you have not configured signatures, you will need to remove
osxSignandosxNotarizefields.
It doesn't work for me. But anyway, thanks a lot!
Please help For me it throws error when creating .pkg file
An unhandled rejection has occurred inside Forge:
(The file “user_script.sh” doesn’t exist.)
makers: [
new MakerSquirrel({ name: productName }),
new MakerZIP({}, ['darwin']),
new MakerRpm({}),
new MakerPKG({
scripts: './user_script.sh',
}),
],
Seems like this is mostly around issues with invalid certs or notarization failures. Closing because it isn't actionable on our end.