Code signing error on Windows Electron build

I’ve looked into several threads on this issue, but nothing has come up in terms of a correct solution. How do I dive deeper to understand what’s going on with this SignTool Error? The exact same configuration works locally on my Windows 10 machine.

Some links I’ve looked into:

Here’s the build error:
https://travis-ci.com/github/rize-io/sol/builds/234035148

  • packaging       platform=win32 arch=x64 electron=11.1.1 appOutDir=dist\win-unpacked
  • Unpacking electron zip  zipPath=undefined
  • downloading     url=https://github.com/electron/electron/releases/download/v11.1.1/electron-v11.1.1-win32-x64.zip size=78 MB parts=4
  • downloaded      url=https://github.com/electron/electron/releases/download/v11.1.1/electron-v11.1.1-win32-x64.zip duration=725ms
  • downloading     url=https://rize-io.s3.us-west-1.amazonaws.com/system/certifications/windows.pfx size=4.6 kB parts=1
  • downloaded      url=https://rize-io.s3.us-west-1.amazonaws.com/system/certifications/windows.pfx duration=567ms
  • downloading     url=https://github.com/electron-userland/electron-builder-binaries/releases/download/winCodeSign-2.6.0/winCodeSign-2.6.0.7z size=5.6 MB parts=1
  • downloaded      url=https://github.com/electron-userland/electron-builder-binaries/releases/download/winCodeSign-2.6.0/winCodeSign-2.6.0.7z duration=464ms
  • signing         file=dist\win-unpacked\Rize (Staging).exe certificateFile=C:\Users\travis\AppData\Local\Temp\t-mi9Oty\0.p12
  ⨯ Exit code: 1. Command failed: C:\Users\travis\AppData\Local\electron-builder\Cache\winCodeSign\winCodeSign-2.6.0\windows-10\x64\signtool.exe sign /t http://timestamp.digicert.com /f C:\Users\travis\AppData\Local\Temp\t-mi9Oty\0.p12 /d Rize (Staging) /du https://github.com/rize-io/sol#readme /p 8c5cebf251449307cd07b40ce8a187a4eb7d0d3687082290b822b0bed72983c2 (sha256 hash) /debug C:\Users\travis\build\rize-io\sol\electron\dist\win-unpacked\Rize (Staging).exe
SignTool Error: An unexpected internal error has occurred.
Error information: "Error: Store::ImportCertObject() failed." (-2146893808/0x80090010)
SignTool Error: An unexpected internal error has occurred.
  stackTrace=

Error: Exit code: 1. Command failed: C:\Users\travis\AppData\Local\electron-builder\Cache\winCodeSign\winCodeSign-2.6.0\windows-10\x64\signtool.exe sign /t http://timestamp.digicert.com /f C:\Users\travis\AppData\Local\Temp\t-mi9Oty\0.p12 /d Rize (Staging) /du https://github.com/rize-io/sol#readme /p 8c5cebf251449307cd07b40ce8a187a4eb7d0d3687082290b822b0bed72983c2 (sha256 hash) /debug C:\Users\travis\build\rize-io\sol\electron\dist\win-unpacked\Rize (Staging).exe

SignTool Error: An unexpected internal error has occurred.

Error information: "Error: Store::ImportCertObject() failed." (-2146893808/0x80090010)

SignTool Error: An unexpected internal error has occurred.

at C:\Users\travis\build\rize-io\sol\electron\node_modules\builder-util\src\util.ts:129:16
at ChildProcess.exithandler (child_process.js:310:5)
at ChildProcess.emit (events.js:311:20)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)

From previous event:
at processImmediate (internal/timers.js:456:21)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       From previous event:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           at WinPackager.signApp (C:\Users\travis\build\rize-io\sol\electron\node_modules\app-builder-lib\src\winPackager.ts:357:27)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           at WinPackager.doSignAfterPack (C:\Users\travis\build\rize-io\sol\electron\node_modules\app-builder-lib\src\platformPackager.ts:270:16)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           at WinPackager.doPack (C:\Users\travis\build\rize-io\sol\electron\node_modules\app-builder-lib\src\platformPackager.ts:255:7)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           at WinPackager.pack (C:\Users\travis\build\rize-io\sol\electron\node_modules\app-builder-lib\src\platformPackager.ts:115:5)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           at Packager.doBuild (C:\Users\travis\build\rize-io\sol\electron\node_modules\app-builder-lib\src\packager.ts:434:9)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           at executeFinally (C:\Users\travis\build\rize-io\sol\electron\node_modules\builder-util\src\promise.ts:12:14)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           at Packager._build (C:\Users\travis\build\rize-io\sol\electron\node_modules\app-builder-lib\src\packager.ts:369:31)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           at Packager.build (C:\Users\travis\build\rize-io\sol\electron\node_modules\app-builder-lib\src\packager.ts:333:12)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           at executeFinally (C:\Users\travis\build\rize-io\sol\electron\node_modules\builder-util\src\promise.ts:12:14)
The command "npm run build" exited with 1.
cache.2
store build cache
Done. Your build exited with 1.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @sol/electron@0.7.17-alpha.8 dist-win: `npm run compile && electron-builder -w --config electron.config.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @sol/electron@0.7.17-alpha.8 dist-win script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\travis\AppData\Roaming\npm-cache\_logs\2021-07-29T21_30_31_695Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @sol/electron@0.7.17-alpha.8 build: `scripts/run-build.sh`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @sol/electron@0.7.17-alpha.8 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\travis\AppData\Roaming\npm-cache\_logs\2021-07-29T21_30_31_724Z-debug.log

May be related to

@Montana you have fixed that problem since, right?

I’m not able to see the build for whatever reason, but a few things should solve this issue, try adding this into your .travis.yml:

before_install:
  - if [ "$TRAVIS_OS_NAME" = "windows" ] || [ "$TRAVIS_OS_NAME" = "linux" ]; then unset CSC_KEY_PASSWORD CSC_LINK; fi

Secondly, most have success with this issue when they make two changes to the project in question, in which some do not have any specific codesign config other than the WIN_CSC_LINK and WIN_CSC_KEY_PASSWORD vars.

In your .travis.yml add this line to the before_install section:

certutil -p $WIN_CSC_KEY_PASSWORD -importpfx ./travis/cert.p12

In the Electron Builder configuration you’ll need to add the certificateSubjectName to the win section as is described over here: Any Windows Target - electron-builder.

2 Likes
Imprint