Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MakerSquirrel fails to build an up because of broken windowsSign config #3770

Open
3 tasks done
RareScrap opened this issue Nov 29, 2024 · 4 comments
Open
3 tasks done

Comments

@RareScrap
Copy link

Pre-flight checklist

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project uses.
  • 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

@nikwen
Copy link

nikwen commented Nov 29, 2024

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 electron/windows-sign#48.)

@RareScrap
Copy link
Author

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?

@nikwen
Copy link

nikwen commented Dec 1, 2024

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

@RareScrap
Copy link
Author

RareScrap commented Dec 1, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants