Electron Builder is getting stuck on Signing DMG

Hello Team,

I am building an Electron app and building platform-related installers line exe, appimage and dmg. To build an installer, I am using the electron builder library.

When I do code signing and notarization, the signing process gets stuck without any error. I have verified certificate and other information are correct. Below are more details.

Versions

  • @electron/notarize": "^2.5.0
  • @electron/rebuild": "3.3.0
  • electron": "26.2.1
  • electron-builder": "^25.1.8
  • electron-devtools-installer": "3.2.0

Current Setup

  • CircleCI pipeline
  • Developer ID Application certificate is properly installed and verified
  • Notarization is configured in both package.json and build arguments

I see the last log as below where it gets stuck without any error.

  • selecting signing options  file=release/build/mac-arm64/xxxx Assistant.app entitlements=assets/entitlements.mac.plist hardenedRuntime=true timestamp=http://timestamp.apple.com/ts01 requirements=undefined additionalArguments=[]

Package.json


"build": {
"productName": "xxxxx - Your AI Work xxxxx",
"executableName": "xxxx xxxxx",
"artifactName": "xxxxx-Assistant-${version}-${arch}.${ext}",
"appId": "org.erb.xxxx",
"asar": true,
"asarUnpack": "**\\*.{node,dll}",
"files": [
  "dist",
  "node_modules",
  "package.json",
  "assets/tray.ico",
  "!**/*.lproj/**/*",
  "!**/locale.pak",
  "!locales/**/*"
],
"afterSign": ".erb/scripts/notarize.js",
"mac": {
  "timestamp": "http://timestamp.apple.com/ts01",
  "identity": "xxxxx Technology Inc (xxxxxxxx)",
  "target": [
	"dmg",
	"zip"
  ],
  "electronLanguages": [
	"en-US"
  ],
  "icon": "build/mac-icon/Logo512x512.icns",
  "type": "distribution",
  "hardenedRuntime": true,
  "entitlements": "assets/entitlements.mac.plist",
  "entitlementsInherit": "assets/entitlements.mac.plist",
  "gatekeeperAssess": false
},
"dmg": {
  "icon": "build/mac-icon/xxxxxxLogo512x512.icns",
  "contents": [
	{
	  "x": 130,
	  "y": 220
	},
	{
	  "x": 410,
	  "y": 220,
	  "type": "link",
	  "path": "/Applications"
	}
  ]
},
"directories": {
  "app": "release/app",
  "buildResources": "assets",
  "output": "release/build"
},
"extraResources": [
  "./assets/**"
]
}

Entitlement

<?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>
    <!-- Required for Electron/Chromium JIT -->
    <key>com.apple.security.cs.allow-jit</key>
    <true/>
    <!-- Required for basic Electron functionality -->
    <key>com.apple.security.inherit</key>
    <true/>
    <!-- Required for network communication (REST APIs) -->
    <key>com.apple.security.network.client</key>
    <true/>
  </dict>
</plist>

I have made the following verification.

  • I already tried on multiple macos with different processors.
  • Verified on a high-speed network.
  • Certificate is exported to .p12 and verified.
  • All Env Variables are set with the correct value. (APPLE_APP_SPECIFIC_PASSWORD+APPLE_ID+APPLE_TEAM_ID )
  • I have tried with CSC_LINK/CSC_KEY_PASSWORD + Keystore as well.

Appriciate any help.

Answered by VipulkumarPatel in 820663022

Got the solution.

  1. Make sure appPath in Notarization should exist.
const appName = context.packager.appInfo.productFilename;
await notarize({
      tool: 'notarytool',
      appBundleId: build.appId,
      appPath: `${appOutDir}/${appName}.app`,
      appleId: process.env.APPLE_ID,
      appleIdPassword: process.env.APPLE_APP_SPECIFIC_PASSWORD,
      teamId: process.env.APPLE_TEAM_ID
    });

In my case, appName was different and notarization process get stuck without any error.

  1. Do not sign DMG.

Ref this article - https://kilianvalkhof.com/2019/electron/notarizing-your-electron-application/

i got same issue, i read from documentation notarization take 5-15 minute. But i dont get any response after 5 hours 😭

It just keeps going and ends with the below exception.

Error: HTTPError(statusCode: nil, error: Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={_kCFStreamErrorCodeKey=-2102, NSUnderlyingError=0x60000392e8e0 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 "(null)" UserInfo={_kCFStreamErrorCodeKey=-2102, _kCFStreamErrorDomainKey=4}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <54B997FC-9FAA-4F06-A18F-F281DF0C8930>.<531>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <54B997FC-9FAA-4F06-A18F-F281DF0C8930>.<531>"
), NSLocalizedDescription=The request timed out., NSErrorFailingURLStringKey=https://appstoreconnect.apple.com/notary/v2/submissions/deb9b590-01e1-41c1-85bd-81d91289fab8?, NSErrorFailingURLKey=https://appstoreconnect.apple.com/notary/v2/submissions/deb9b590-01e1-41c1-85bd-81d91289fab8?, _kCFStreamErrorDomainKey=4})
Accepted Answer

Got the solution.

  1. Make sure appPath in Notarization should exist.
const appName = context.packager.appInfo.productFilename;
await notarize({
      tool: 'notarytool',
      appBundleId: build.appId,
      appPath: `${appOutDir}/${appName}.app`,
      appleId: process.env.APPLE_ID,
      appleIdPassword: process.env.APPLE_APP_SPECIFIC_PASSWORD,
      teamId: process.env.APPLE_TEAM_ID
    });

In my case, appName was different and notarization process get stuck without any error.

  1. Do not sign DMG.

Ref this article - https://kilianvalkhof.com/2019/electron/notarizing-your-electron-application/

Electron Builder is getting stuck on Signing DMG
 
 
Q