I tried to notarize (Code sign) Electron Node.js app using Electron forge to submit it to Mac App Store (MAS) by following the option Using an app-specific password mentioned in Electron forge official guide, but encountering error - "Failed to staple your application with code: 66. Cannot download ticket. CDHash must be set."
My app's forge.config.js file is as follows (ensured that appleId, appleIdPassword, teamId are accuarte):
module.exports = {
packagerConfig: {
osxSign: {},
osxNotarize: {
tool: 'notarytool',
appleId: '******',
appleIdPassword: '******',
teamId: '******',
}
},
rebuildConfig: {},
makers: [
{
name: '@electron-forge/maker-squirrel',
config: {},
},
{
name: '@electron-forge/maker-zip',
platforms: ['darwin'],
},
{
name: '@electron-forge/maker-deb',
config: {},
},
{
name: '@electron-forge/maker-rpm',
config: {},
},
],
};
My Node.js application's package.json has the scripts as follows:
"scripts": {
"start": "electron-forge start",
"package": "electron-forge package",
"make": "electron-forge make"
},
But on executing npm run make to do code signing and generate the app, encountering the following error repeatedly on multiple retries:
An unhandled rejection has occurred inside Forge:
Error: Failed to staple your application with code: 66
Processing: /private/var/folders/h3/vkfpv17950z45hg1z5tjfq000000gn/T/electron-packager/darwin-x64/myapp-darwin-x64-wgLqgW/myapp.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 Object.<anonymous> (/path/myapp/node_modules/@electron/notarize/lib/staple.js:22:19)
at Generator.next (<anonymous>)
at fulfilled (/path/myapp/node_modules/@electron/notarize/lib/staple.js:4:58)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Can you please help debug the reason for the failure?