forge icon indicating copy to clipboard operation
forge copied to clipboard

MakerSquirrel fails to build an up because of broken windowsSign config

Open RareScrap opened this issue 1 year ago • 6 comments

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

7.6.0

Electron version

33.2.1

Operating system

Microsoft Windows 11 Pro N (10.0.22621 N/A Build 22621)

Last known working Electron Forge version

No response

Expected behavior

The executable file has been created and signed.

Actual behavior

MakerSquirrel crashes with exit code 4294967295

Steps to reproduce

  1. Init an Electron project using the webpack-typescript template:
    npm init electron-app@latest my-new-app -- --template=webpack-typescript
    
  2. Install dependencies:
    npm i
    
  3. Provide a path to codesign pfx file and password using the windowsSign parameter of MakerSquirrelConfig in the forge.config.ts file:
    new MakerSquirrel({
      // This works and solve the problem but it's legacy, according to its docs
      // certificateFile: "C:\\Users\\user\\my_codesign_certificate.pfx",
      // certificatePassword: "my-password"
      windowsSign: {
        certificateFile: "C:\\Users\\user\\my_codesign_certificate.pfx",
        certificatePassword: "my-password"
      }
    }
    
  4. Run makers:
    npm run make
    

Additional information

Console output as is
PS C:\Users\user\my-app> npm run make

> [email protected] make
> electron-forge make

✔ Checking your system
✔ Loading configuration
✔ Resolving make targets
  › Making for the following targets:
✔ Running package command
  ✔ Preparing to package application
  ✔ Running packaging hooks
    ✔ Running generateAssets hook
    ✔ Running prePackage hook
      ✔ [plugin-webpack] Preparing webpack bundles
        ✔ Preparing native dependencies [1s]
        ✔ Building webpack bundles [4s]
  ✔ Packaging application
    ✔ Packaging for x64 on win32 [5s]
  ✔ Running postPackage hook
✔ Running preMake hook
❯ Making distributables
  ✖ Making a squirrel distributable for win32/x64
    › Failed with exit code: 4294967295
    Output:
    System.AggregateException: One or more errors occurred. ---> System.Exception: Failed to sign, command invoked was:
    'C:\Users\user\my-app\node_modules\electron-winstaller\vendor\signtool.exe sign windows-sign C:\Users\user\AppData\Local\SquirrelTemp\tempa\lib\net45\ffmpeg.dll'
    at Squirrel.Update.Program.<signPEFile>d__17.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Squirrel.Update.Program.<>c__DisplayClass10_0.<<Releasify>b__14>d.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at Squirrel.Utility.<>c__DisplayClass13_1`1.<<ForEachAsync>b__1>d.MoveNext()
    --- End of inner exception stack trace ---
    at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
    at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
    at Squirrel.Update.Program.<>c__DisplayClass10_0.<Releasify>b__7(String pkgPath)
    at Squirrel.ReleasePackage.CreateReleasePackage(String outputFile, String packagesRootDir, Func`2 releaseNotesProcessor, Action`1 contentsPostProcessHook)
    at Squirrel.Update.Program.Releasify(String package, String targetDir, String packagesDir, String bootstrapperExe, String backgroundGif, String signingOpts, String baseUrl, String
    setupIcon, Boolean generateMsi, Boolean packageAs64Bit, String frameworkVersion, Boolean generateDeltas)
    at Squirrel.Update.Program.executeCommandLine(String[] args)
    at Squirrel.Update.Program.main(String[] args)
    at Squirrel.Update.Program.Main(String[] args)
    ---> (Inner Exception #0) System.Exception: Failed to sign, command invoked was: 'C:\Users\user\my-app\node_modules\electron-winstaller\vendor\signtool.exe sign windows-sign    
    C:\Users\user\AppData\Local\SquirrelTemp\tempa\lib\net45\ffmpeg.dll'
    at Squirrel.Update.Program.<signPEFile>d__17.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Squirrel.Update.Program.<>c__DisplayClass10_0.<<Releasify>b__14>d.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at Squirrel.Utility.<>c__DisplayClass13_1`1.<<ForEachAsync>b__1>d.MoveNext()<---
◼ Running postMake hook

An unhandled rejection has occurred inside Forge:
Error: Failed with exit code: 4294967295
Output:
System.AggregateException: One or more errors occurred. ---> System.Exception: Failed to sign, command invoked was: 'C:\Users\user\my-app\node_modules\electron-winstaller\vendor\signtool.exe sign windows-sign C:\Users\user\AppData\Local\SquirrelTemp\tempa\lib\net45\ffmpeg.dll'
   at Squirrel.Update.Program.<signPEFile>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Squirrel.Update.Program.<>c__DisplayClass10_0.<<Releasify>b__14>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Squirrel.Utility.<>c__DisplayClass13_1`1.<<ForEachAsync>b__1>d.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at Squirrel.Update.Program.<>c__DisplayClass10_0.<Releasify>b__7(String pkgPath)
   at Squirrel.ReleasePackage.CreateReleasePackage(String outputFile, String packagesRootDir, Func`2 releaseNotesProcessor, Action`1 contentsPostProcessHook)
   at Squirrel.Update.Program.Releasify(String package, String targetDir, String packagesDir, String bootstrapperExe, String backgroundGif, String signingOpts, String baseUrl, String setupIcon, Boolean generateMsi, Boolean packageAs64Bit, String frameworkVersion, Boolean generateDeltas)
   at Squirrel.Update.Program.executeCommandLine(String[] args)
   at Squirrel.Update.Program.main(String[] args)
   at Squirrel.Update.Program.Main(String[] args)
---> (Inner Exception #0) System.Exception: Failed to sign, command invoked was: 'C:\Users\user\my-app\node_modules\electron-winstaller\vendor\signtool.exe sign windows-sign C:\Users\user\AppData\Local\SquirrelTemp\tempa\lib\net45\ffmpeg.dll'
   at Squirrel.Update.Program.<signPEFile>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Squirrel.Update.Program.<>c__DisplayClass10_0.<<Releasify>b__14>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Squirrel.Utility.<>c__DisplayClass13_1`1.<<ForEachAsync>b__1>d.MoveNext()<---

An unhandled exception has occurred inside Forge:
Failed with exit code: 4294967295
Output:
System.AggregateException: One or more errors occurred. ---> System.Exception: Failed to sign, command invoked was: 'C:\Users\user\my-app\node_modules\electron-winstaller\vendor\signtool.exe sign windows-sign C:\Users\user\AppData\Local\SquirrelTemp\tempa\lib\net45\ffmpeg.dll'
   at Squirrel.Update.Program.<signPEFile>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Squirrel.Update.Program.<>c__DisplayClass10_0.<<Releasify>b__14>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Squirrel.Utility.<>c__DisplayClass13_1`1.<<ForEachAsync>b__1>d.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at Squirrel.Update.Program.<>c__DisplayClass10_0.<Releasify>b__7(String pkgPath)
   at Squirrel.ReleasePackage.CreateReleasePackage(String outputFile, String packagesRootDir, Func`2 releaseNotesProcessor, Action`1 contentsPostProcessHook)
   at Squirrel.Update.Program.Releasify(String package, String targetDir, String packagesDir, String bootstrapperExe, String backgroundGif, String signingOpts, String baseUrl, String setupIcon, Boolean generateMsi, Boolean packageAs64Bit, String frameworkVersion, Boolean generateDeltas)
   at Squirrel.Update.Program.executeCommandLine(String[] args)
   at Squirrel.Update.Program.main(String[] args)
   at Squirrel.Update.Program.Main(String[] args)
---> (Inner Exception #0) System.Exception: Failed to sign, command invoked was: 'C:\Users\user\my-app\node_modules\electron-winstaller\vendor\signtool.exe sign windows-sign C:\Users\user\AppData\Local\SquirrelTemp\tempa\lib\net45\ffmpeg.dll'
   at Squirrel.Update.Program.<signPEFile>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Squirrel.Update.Program.<>c__DisplayClass10_0.<<Releasify>b__14>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Squirrel.Utility.<>c__DisplayClass13_1`1.<<ForEachAsync>b__1>d.MoveNext()<---


Error: Failed with exit code: 4294967295
Output:
System.AggregateException: One or more errors occurred. ---> System.Exception: Failed to sign, command invoked was: 'C:\Users\user\my-app\node_modules\electron-winstaller\vendor\signtool.exe sign windows-sign C:\Users\user\AppData\Local\SquirrelTemp\tempa\lib\net45\ffmpeg.dll'
   at Squirrel.Update.Program.<signPEFile>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Squirrel.Update.Program.<>c__DisplayClass10_0.<<Releasify>b__14>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Squirrel.Utility.<>c__DisplayClass13_1`1.<<ForEachAsync>b__1>d.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at Squirrel.Update.Program.<>c__DisplayClass10_0.<Releasify>b__7(String pkgPath)
   at Squirrel.ReleasePackage.CreateReleasePackage(String outputFile, String packagesRootDir, Func`2 releaseNotesProcessor, Action`1 contentsPostProcessHook)
   at Squirrel.Update.Program.Releasify(String package, String targetDir, String packagesDir, String bootstrapperExe, String backgroundGif, String signingOpts, String baseUrl, String setupIcon, Boolean generateMsi, Boolean packageAs64Bit, String frameworkVersion, Boolean generateDeltas)
   at Squirrel.Update.Program.executeCommandLine(String[] args)
   at Squirrel.Update.Program.main(String[] args)
   at Squirrel.Update.Program.Main(String[] args)
---> (Inner Exception #0) System.Exception: Failed to sign, command invoked was: 'C:\Users\user\my-app\node_modules\electron-winstaller\vendor\signtool.exe sign windows-sign C:\Users\user\AppData\Local\SquirrelTemp\tempa\lib\net45\ffmpeg.dll'
   at Squirrel.Update.Program.<signPEFile>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Squirrel.Update.Program.<>c__DisplayClass10_0.<<Releasify>b__14>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Squirrel.Utility.<>c__DisplayClass13_1`1.<<ForEachAsync>b__1>d.MoveNext()<---


    at ChildProcess.<anonymous> (C:\Users\user\my-app\node_modules\electron-winstaller\src\spawn-promise.ts:51:16)
    at ChildProcess.emit (node:events:514:28)
    at ChildProcess.emit (node:domain:488:12)
    at maybeClose (node:internal/child_process:1105:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:305:5)
Console output with DEBUG=electron-forge:*
PS C:\Users\user\my-app> npm run make            

> [email protected] make
> electron-forge make

✔ Checking your system

electron-forge:check-system checking system, create ~/.skip-forge-system-check to stop doing this +0ms
❯ Loading configuration
  electron-forge:project-resolver searching for project in: C:\Users\user\my-app +0ms
  electron-forge:project-resolver package.json with forge dependency found in C:\Users\user\my-app\package.json +2ms
  electron-forge:plugin:webpack hooking process events +0ms
✔ Loading configuration
❯ Resolving make targets
› Making for the following targets: 
✔ Resolving make targets
❯ Running package command
❯ Preparing to package application
  electron-forge:project-resolver searching for project in: C:\Users\user\my-app +2s
  electron-forge:project-resolver package.json with forge dependency found in C:\Users\user\my-app\package.json +1ms
  electron-forge:plugin:webpack hooking process events +12ms
✔ Preparing to package application
❯ Running packaging hooks
❯ Running generateAssets hook
✔ Running generateAssets hook
❯ Running prePackage hook
❯ [plugin-webpack] Preparing webpack bundles
❯ Preparing native dependencies for x64
✔ Preparing native dependencies
❯ Building webpack bundles
  electron-forge:plugin:webpack:webpackconfig Config mode: production +0ms
✔ Building webpack bundles
✔ [plugin-webpack] Preparing webpack bundles
✔ Running prePackage hook
✔ Running packaging hooks
❯ Packaging application
› Determining targets...
  electron-forge:packager packaging with options {
  asar: { unpack: '{**/*.node,**/*.node}' },
  overwrite: true,
  ignore: [Function (anonymous)],
  quiet: true,
  dir: 'C:\\Users\\user\\my-app',
  arch: 'x64',
  platform: 'win32',
  afterFinalizePackageTargets: [ [AsyncFunction (anonymous)] ],
  afterComplete: [ [AsyncFunction (anonymous)] ],
  afterCopy: [ [AsyncFunction (anonymous)] ],
  afterExtract: [ [AsyncFunction (anonymous)] ],
  afterPrune: [ [AsyncFunction (anonymous)] ],
  out: 'C:\\Users\\user\\my-app\\out',
  electronVersion: '33.2.1'
} +0ms
  electron-forge:packager targets: [ { platform: 'win32', arch: 'x64' } ] +6ms
❯ Packaging for x64 on win32
❯ Copying files
❯ Preparing native dependencies
❯ Finalizing package
✔ Copying files
✔ Preparing native dependencies
✔ Finalizing package
✔ Packaging for x64 on win32
✔ Packaging application
❯ Running postPackage hook
  electron-forge:packager outputPaths: [ 'C:\\Users\\user\\my-app\\out\\my-app-win32-x64' ] +5s
✔ Running postPackage hook
✔ Running package command
❯ Running preMake hook
✔ Running preMake hook
❯ Making distributables
❯ Making a squirrel distributable for win32/x64
✖ Making a squirrel distributable for win32/x64 [FAILED: Failed with exit code: 4294967295
Output:
System.AggregateException: One or more errors occurred. ---> System.Exception: Failed to sign, command invoked was: 'C:\Users\user\my-app\node_modules\electron-winstaller\vendor\signtool.exe sign windows-sign C:\Users\user\AppData\Local\SquirrelTemp\tempa\lib\net45\ffmpeg.dll'
   at Squirrel.Update.Program.<signPEFile>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Squirrel.Update.Program.<>c__DisplayClass10_0.<<Releasify>b__14>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Squirrel.Utility.<>c__DisplayClass13_1`1.<<ForEachAsync>b__1>d.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at Squirrel.Update.Program.<>c__DisplayClass10_0.<Releasify>b__7(String pkgPath)
   at Squirrel.ReleasePackage.CreateReleasePackage(String outputFile, String packagesRootDir, Func`2 releaseNotesProcessor, Action`1 contentsPostProcessHook)
   at Squirrel.Update.Program.Releasify(String package, String targetDir, String packagesDir, String bootstrapperExe, String backgroundGif, String signingOpts, String baseUrl, String setupIcon, Boolean generateMsi, Boolean packageAs64Bit, String frameworkVersion, Boolean generateDeltas)
   at Squirrel.Update.Program.executeCommandLine(String[] args)
   at Squirrel.Update.Program.main(String[] args)
   at Squirrel.Update.Program.Main(String[] args)
---> (Inner Exception #0) System.Exception: Failed to sign, command invoked was: 'C:\Users\user\my-app\node_modules\electron-winstaller\vendor\signtool.exe sign windows-sign C:\Users\user\AppData\Local\SquirrelTemp\tempa\lib\net45\ffmpeg.dll'
   at Squirrel.Update.Program.<signPEFile>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Squirrel.Update.Program.<>c__DisplayClass10_0.<<Releasify>b__14>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Squirrel.Utility.<>c__DisplayClass13_1`1.<<ForEachAsync>b__1>d.MoveNext()<---

]
✖ Making distributables [FAILED: Failed with exit code: 4294967295
Output:
System.AggregateException: One or more errors occurred. ---> System.Exception: Failed to sign, command invoked was: 'C:\Users\user\my-app\node_modules\electron-winstaller\vendor\signtool.exe sign windows-sign C:\Users\user\AppData\Local\SquirrelTemp\tempa\lib\net45\ffmpeg.dll'
   at Squirrel.Update.Program.<signPEFile>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Squirrel.Update.Program.<>c__DisplayClass10_0.<<Releasify>b__14>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Squirrel.Utility.<>c__DisplayClass13_1`1.<<ForEachAsync>b__1>d.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at Squirrel.Update.Program.<>c__DisplayClass10_0.<Releasify>b__7(String pkgPath)
   at Squirrel.ReleasePackage.CreateReleasePackage(String outputFile, String packagesRootDir, Func`2 releaseNotesProcessor, Action`1 contentsPostProcessHook)
   at Squirrel.Update.Program.Releasify(String package, String targetDir, String packagesDir, String bootstrapperExe, String backgroundGif, String signingOpts, String baseUrl, String setupIcon, Boolean generateMsi, Boolean packageAs64Bit, String frameworkVersion, Boolean generateDeltas)
   at Squirrel.Update.Program.executeCommandLine(String[] args)
   at Squirrel.Update.Program.main(String[] args)
   at Squirrel.Update.Program.Main(String[] args)
---> (Inner Exception #0) System.Exception: Failed to sign, command invoked was: 'C:\Users\user\my-app\node_modules\electron-winstaller\vendor\signtool.exe sign windows-sign C:\Users\user\AppData\Local\SquirrelTemp\tempa\lib\net45\ffmpeg.dll'
   at Squirrel.Update.Program.<signPEFile>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Squirrel.Update.Program.<>c__DisplayClass10_0.<<Releasify>b__14>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Squirrel.Utility.<>c__DisplayClass13_1`1.<<ForEachAsync>b__1>d.MoveNext()<---

]

An unhandled rejection has occurred inside Forge:
Error: Failed with exit code: 4294967295
Output:
System.AggregateException: One or more errors occurred. ---> System.Exception: Failed to sign, command invoked was: 'C:\Users\user\my-app\node_modules\electron-winstaller\vendor\signtool.exe sign windows-sign C:\Users\user\AppData\Local\SquirrelTemp\tempa\lib\net45\ffmpeg.dll'
   at Squirrel.Update.Program.<signPEFile>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Squirrel.Update.Program.<>c__DisplayClass10_0.<<Releasify>b__14>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Squirrel.Utility.<>c__DisplayClass13_1`1.<<ForEachAsync>b__1>d.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at Squirrel.Update.Program.<>c__DisplayClass10_0.<Releasify>b__7(String pkgPath)
   at Squirrel.ReleasePackage.CreateReleasePackage(String outputFile, String packagesRootDir, Func`2 releaseNotesProcessor, Action`1 contentsPostProcessHook)
   at Squirrel.Update.Program.Releasify(String package, String targetDir, String packagesDir, String bootstrapperExe, String backgroundGif, String signingOpts, String baseUrl, String setupIcon, Boolean generateMsi, Boolean packageAs64Bit, String frameworkVersion, Boolean generateDeltas)
   at Squirrel.Update.Program.executeCommandLine(String[] args)
   at Squirrel.Update.Program.main(String[] args)
   at Squirrel.Update.Program.Main(String[] args)
---> (Inner Exception #0) System.Exception: Failed to sign, command invoked was: 'C:\Users\user\my-app\node_modules\electron-winstaller\vendor\signtool.exe sign windows-sign C:\Users\user\AppData\Local\SquirrelTemp\tempa\lib\net45\ffmpeg.dll'
   at Squirrel.Update.Program.<signPEFile>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Squirrel.Update.Program.<>c__DisplayClass10_0.<<Releasify>b__14>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Squirrel.Utility.<>c__DisplayClass13_1`1.<<ForEachAsync>b__1>d.MoveNext()<---

An unhandled exception has occurred inside Forge:
Failed with exit code: 4294967295
Output:
System.AggregateException: One or more errors occurred. ---> System.Exception: Failed to sign, command invoked was: 'C:\Users\user\my-app\node_modules\electron-winstaller\vendor\signtool.exe sign windows-sign C:\Users\user\AppData\Local\SquirrelTemp\tempa\lib\net45\ffmpeg.dll'
   at Squirrel.Update.Program.<signPEFile>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Squirrel.Update.Program.<>c__DisplayClass10_0.<<Releasify>b__14>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Squirrel.Utility.<>c__DisplayClass13_1`1.<<ForEachAsync>b__1>d.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at Squirrel.Update.Program.<>c__DisplayClass10_0.<Releasify>b__7(String pkgPath)
   at Squirrel.ReleasePackage.CreateReleasePackage(String outputFile, String packagesRootDir, Func`2 releaseNotesProcessor, Action`1 contentsPostProcessHook)
   at Squirrel.Update.Program.Releasify(String package, String targetDir, String packagesDir, String bootstrapperExe, String backgroundGif, String signingOpts, String baseUrl, String setupIcon, Boolean generateMsi, Boolean packageAs64Bit, String frameworkVersion, Boolean generateDeltas)
   at Squirrel.Update.Program.executeCommandLine(String[] args)
   at Squirrel.Update.Program.main(String[] args)
   at Squirrel.Update.Program.Main(String[] args)
---> (Inner Exception #0) System.Exception: Failed to sign, command invoked was: 'C:\Users\user\my-app\node_modules\electron-winstaller\vendor\signtool.exe sign windows-sign C:\Users\user\AppData\Local\SquirrelTemp\tempa\lib\net45\ffmpeg.dll'
   at Squirrel.Update.Program.<signPEFile>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Squirrel.Update.Program.<>c__DisplayClass10_0.<<Releasify>b__14>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Squirrel.Utility.<>c__DisplayClass13_1`1.<<ForEachAsync>b__1>d.MoveNext()<---


Error: Failed with exit code: 4294967295
Output:
System.AggregateException: One or more errors occurred. ---> System.Exception: Failed to sign, command invoked was: 'C:\Users\user\my-app\node_modules\electron-winstaller\vendor\signtool.exe sign windows-sign C:\Users\user\AppData\Local\SquirrelTemp\tempa\lib\net45\ffmpeg.dll'
   at Squirrel.Update.Program.<signPEFile>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Squirrel.Update.Program.<>c__DisplayClass10_0.<<Releasify>b__14>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Squirrel.Utility.<>c__DisplayClass13_1`1.<<ForEachAsync>b__1>d.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at Squirrel.Update.Program.<>c__DisplayClass10_0.<Releasify>b__7(String pkgPath)
   at Squirrel.ReleasePackage.CreateReleasePackage(String outputFile, String packagesRootDir, Func`2 releaseNotesProcessor, Action`1 contentsPostProcessHook)
   at Squirrel.Update.Program.Releasify(String package, String targetDir, String packagesDir, String bootstrapperExe, String backgroundGif, String signingOpts, String baseUrl, String setupIcon, Boolean generateMsi, Boolean packageAs64Bit, String frameworkVersion, Boolean generateDeltas)
   at Squirrel.Update.Program.executeCommandLine(String[] args)
   at Squirrel.Update.Program.main(String[] args)
   at Squirrel.Update.Program.Main(String[] args)
---> (Inner Exception #0) System.Exception: Failed to sign, command invoked was: 'C:\Users\user\my-app\node_modules\electron-winstaller\vendor\signtool.exe sign windows-sign C:\Users\user\AppData\Local\SquirrelTemp\tempa\lib\net45\ffmpeg.dll'
   at Squirrel.Update.Program.<signPEFile>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Squirrel.Update.Program.<>c__DisplayClass10_0.<<Releasify>b__14>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Squirrel.Utility.<>c__DisplayClass13_1`1.<<ForEachAsync>b__1>d.MoveNext()<---


    at ChildProcess.<anonymous> (C:\Users\user\my-app\node_modules\electron-winstaller\src\spawn-promise.ts:51:16)
    at ChildProcess.emit (node:events:514:28)
    at ChildProcess.emit (node:domain:488:12)
    at maybeClose (node:internal/child_process:1105:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:305:5)
  electron-forge:plugin:webpack handling process exit with: { cleanup: true } +42s
  electron-forge:plugin:webpack handling process exit with: { cleanup: true } +2ms

The app project source code that reproduces the error

RareScrap avatar Nov 29 '24 13:11 RareScrap

This indicates signing failed. Usually, this happens if the windowsSign configuration is incorrect.

Unfortunately, it doesn't currently print the exact error message from signtool.exe to the console. You could check if your electron-windows-sign.log contains a useful error message. If not, you could monkey patch this part of the code to understand better what's going on:

https://github.com/electron/windows-sign/blob/c59b1bb4b32353921e6493538a92491847beb777/src/sea.ts#L69-L121

To those scripts, add logging to a log file using fs. (Do not log using console.{log,error}. That will cause other errors that I cannot quite explain yet, see for example https://github.com/electron/windows-sign/pull/48.)

nikwen avatar Nov 29 '24 21:11 nikwen

Usually, this happens if the windowsSign configuration is incorrect

As you can see, singing config is straightforward. It's simply impossible that the configuration is incorrect here:

new MakerSquirrel({
  // As easy as pie
  windowsSign: {
    certificateFile: "C:\\Users\\user\\my_codesign_certificate.pfx",
    certificatePassword: "my-password"
  }
}
Here is the output of the electron-windows-sign.log
C:\Users\user\AppData\Local\SquirrelTemp\tempa\lib\net45\ffmpeg.dll
Error: Signtool exited with code 1. Stderr: SignTool Error: No certificates were found that met all the given criteria.
. Stdout: 
C:\Users\user\AppData\Local\SquirrelTemp\tempa\lib\net45\ffmpeg.dll
Error: Signtool exited with code 1. Stderr: SignTool Error: No certificates were found that met all the given criteria.
. Stdout: 
C:\Users\user\AppData\Local\SquirrelTemp\tempa\lib\net45\ffmpeg.dll
Error: Signtool exited with code 1. Stderr: SignTool Error: No certificates were found that met all the given criteria.
. Stdout: 
C:\Users\user\AppData\Local\SquirrelTemp\tempa\lib\net45\ffmpeg.dll
Error: Signtool exited with code 1. Stderr: SignTool Error: No certificates were found that met all the given criteria.
. Stdout: 
C:\Users\user\AppData\Local\SquirrelTemp\tempa\lib\net45\ffmpeg.dll
Error: Signtool exited with code 1. Stderr: SignTool Error: No certificates were found that met all the given criteria.
. Stdout: 
C:\Users\user\AppData\Local\SquirrelTemp\tempa\lib\net45\ffmpeg.dll
Error: Signtool exited with code 1. Stderr: SignTool Error: An unexpected internal error has occurred.
. Stdout: Error information: "Error: Store IsDiskFile() failed." (-2147024893/0x80070003)

@nikwen Please, try to run it on your own machine to confirm the bug can be reproduced

Also, could the certificates cause this problem?

RareScrap avatar Dec 01 '24 12:12 RareScrap

Yes, the error message implies there's probably something wrong with the certificate.

nikwen avatar Dec 01 '24 13:12 nikwen

something wrong with the certificate.

I think it's still a bug if it works using the legacy parameters and doesn't using the modern way.

Can confirm this bug with this dummy self-issued certificate with password rsis-debug. How could it cause the problem?

RareScrap avatar Dec 01 '24 13:12 RareScrap

I spent a lot of time trying facing the same issue and digging through the depenedencies to try to figure out exactly where the bug was happing (presumably upstream?)

I ended up searching public github repos for examples of correct setups, and what finally allowed it to start working for me was to have the windowsSign defined at both the root project level and the and the MakerSquirrel level.

Here was what finally helped me: https://github.com/felixrieseberg/clippy/blob/d770351f0911ad3a5e9829ff1ea268573d13b1fc/forge.config.ts

I am using digicert with cloud based HSM, which has a number of moving parts since it has to call out to a server and I was going crazy trying to figure out why it would never use the signToolPath that I was providing.

paustint avatar Aug 03 '25 14:08 paustint

I ended up searching public github repos for examples of correct setups, and what finally allowed it to start working for me was to have the windowsSign defined at both the root project level and the and the MakerSquirrel level.

This is necessary to sign both the installer and the application itself.

nikwen avatar Aug 06 '25 00:08 nikwen