-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Auto update failed while executing the powershell command #7127
Comments
We've had 16k reports of this error in Evernote's updater. Error: Command failed: powershell.exe -NoProfile -NonInteractive -InputFormat None -Command Get-AuthenticodeSignature -LiteralPath '***********AppData\Local\evernote-client-updater\pending\temp-Evernote-10.43.7-win-ddl-ga-3598-a51c0cce94-setup.exe' | ... |
Our error logs are also filled with this error: Unhandled Error Any clues how to fix or silence this error? It seems to occur only the first time the app is started according to one user report we got. |
Hi! Here is the command that is failing on Windows if it can be helpful : |
We have the same issue, and not sure under what condition it happens. The code fails here |
We had the issue that appears to occur when the machine doesn't have enough CPU/memory. It was timing out before the certification verification could complete. |
I've also been running into this issue -- but intermittently, even on the same machine. I haven't really noticed a pattern but sometimes it'll resolve itself with a restart of the application in question. Worth noting it doesn't just happen on thin clients for me, reproducible intermittently on my lappy. Powershell version I'm working with
Attempt to run command manuallyI attempted to run the command in it's entirety manually, and was immediately confronted with: powershell.exe -NoProfile -NonInteractive -InputFormat None -Command Get-AuthenticodeSignature -LiteralPath './electron/output/MyApp Setup 9.1.52.exe' | ConvertTo-Json -Compress | ForEach-Object { [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($_)) }
WyJHZXQtQXV0aGVudGljb2RlU2lnbmF0dXJlIDogQSBwb3NpdGlvbmFsIHBhcmFtZXRlciBjYW5ub3QgYmUgZm91bmQgdGhhdCBhY2NlcHRzIGFyZ3VtZW50IFx1MDAyN1NldHVwXHUwMDI3LiIsIkF0IGxpbmU6MSBjaGFyOjEiLCIrIEdldC1BdXRoZW50aWNvZGVTaWduYXR1cmUgLUxpdGVyYWxQYXRoIC4vZWxlY3Ryb24vb3V0cHV0L015QXBwIFNldHVwICAuLi4iLCIrIH5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fiIsIiAgICArIENhdGVnb3J5SW5mbyAgICAgICAgICA6IEludmFsaWRBcmd1bWVudDogKDopIFtHZXQtQXV0aGVudGljb2RlU2lnbmF0dXJlXSwgUGFyYW1ldGVyQmluZGluZ0V4Y2VwdGlvbiIsIiAgICArIEZ1bGx5UXVhbGlmaWVkRXJyb3JJZCA6IFBvc2l0aW9uYWxQYXJhbWV0ZXJOb3RGb3VuZCxNaWNyb3NvZnQuUG93ZXJTaGVsbC5Db21tYW5kcy5HZXRBdXRoZW50aWNvZGVTaWduYXR1cmVDb21tYW5kIiwiICJd The base64 decodes to:
This lead me down to reading a bit more about the Attempt to run with braces
Seems to be that valid inputs are only
Testing the changesTo double check my results I edited child_process_1.execFile("powershell.exe", [
"-NoProfile",
"-NonInteractive",
"-InputFormat",
"Text",
"-Command",
`{Get-AuthenticodeSignature -LiteralPath '${tempUpdateFile}'} | ConvertTo-Json -Compress | ForEach-Object { [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($_)) }`,
] It does seem to not exhibit the issue anymore with my local testing but I'm unsure if this has introduced other issues. I'll update this as and when I test on a few different devices. I'll escalate it up to a proper PR if it seems to be fixed wholesale. |
Any update on this issue? Thank you! |
Unfortunately this doesn't work, it resolves the powershell error but seems to cause publisher verification errors when checking the signatures later in the process.
|
@M3ales You can replace the PowerShell with a native verify signature module to resolve all powershell problems. |
This issue might be fixed by #7230 which is included since [email protected] |
I saw this issue with the recently-released electron-updater 6.1.0 |
We are also still seeing this issue in 6.0.0 |
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
Still issue: 6.1.4 Maybe need add some delay for check... |
Duplicate issue #7051 |
Seeing this pretty frequently in 6.0.3. Haven't discovered any kind of pattern yet.
|
+1 We're seeing it since updated from Haven't figured out any pattern in it other than the fact that most of the cases (but not all of them) are happening when performing
Any chance it may get resolved soon? |
Also hitting this one. Even though I can't reproduce this myself (through the updater), this is what I get when I run this on my machine (both with Powershell 5 as well as 7) ➜ powershell.exe -NoProfile -NonInteractive -InputFormat None -Command Get-AuthenticodeSignature -LiteralPath 'C:/Users/<redacted>/AppData/Local/<redacted>-updater/pending/temp-<redacted>.exe'
Get-AuthenticodeSignature : A positional parameter cannot be found that accepts argument 'Setup'.
At line:1 char:1
+ Get-AuthenticodeSignature -LiteralPath C:/Users/<redacted>/AppData/Loca ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-AuthenticodeSignature], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.GetAuthenticodeSignatureComman
d So, a different error than @M3ales got. I got a similar error when trying to release the app on a Powershell 7 terminal though (as described on #7729) Could this info be useful? Any suggestions what could be done here? Edit: C:\Users\<redacted>\ver
Microsoft Windows [Version 10.0.22621.2428] |
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
Hey there! We've managed to create a setup for which it's failing with 100% repeatability. ContextIt was purely coincidental as it surfaced while we were working on e2e tests for auto-update. How to reproduceCreate a GitHub Action which should run your app assuming it should auto-update. You most likely need to point it to a different update source where you host the test version eg
FindingsverifySignature fails with error
Given the error message:
I did a test with manually importing it - see Which fails with:
I did a bit of research and found the following threads:
However, with hours of try-and-error, I didn't manage to make it pass ImpactAs of today, we see ~40k of these errors a month which varies depending on how often we release. |
Hello @piotr-chowaniec, import win-verify-signature package in your appUpdater file.
With this change, we are not facing same issue which we were facing earlier. Give it a try. |
Same issue here. |
Thank you @piotr-chowaniec for the very detailed writeup #7127 (comment). I'll look into that As @ShubhamSurya06 pointed out, there's an additional hook you can use to write your own code-verifying process or leverage a native module. |
@piotr-chowaniec, quick Q. What happens for you if you set the first exec in your verifySignature.js to be
The suggestion came from one of the docs/posts that you linked.
Versus having I'm still trying to get WSL working in my Windows VM, getting other odd errors like |
@mmaietta Thanks for taking a look at it! Following @ShubhamSurya06 advice I ended up with a custom verify signature implementation, but I took a bit more defensive approach trying to use
Considering the fact we're building not only for windows. I had to add @mmaietta speaking about
But without success so I dropped it. Regarding |
Wonderful news! I'll open a PR fixing that and getting more unit tests up and running.
You're right, that makes sense. It's working in powershell, but my pnpm Windows dev environment is completely wrecked outside of WSL, so I need to figure that out as well. |
@mmaietta I'm a bit hesitant about whether that "small" change won't introduce regression issues. Do you have a way to test it heavily beforehand? If there is any issue caused by it, it'll be very hard to recover other than forcing people to manually install the app. |
@piotr-chowaniec the windows signing verification tests were only running on linux for some reason, so the moment I added them to the In the PR, the unit tests can validate up until the point of installing the app as on windows, the exe can't clean up the process due to the parent test process, and on linux, the rpm/deb changes require an authentication agent (for sudo) for the install to go through. I also tried adding the native signing method to the unit tests, but that caused test failures on mac even with win-verify-signature as an optional dependency. That all being said, I'm am still trying to create a dev self-signed cert on windows to test further with, but it's proving to be quite difficult. electron-builder's |
@piotr-chowaniec following up back here. I was able to get windows auto-update on a local minio server working on my windows Parallels VM with a self-signed certificate. I wasn't able to reproduce the original error here where signature verification fails on my VM though, only could via the CI unit tests on a windows-latest GH runner. With my code changes in PR #8051, the update flow still works on my VM. As with all electron-updater releases, this will be a |
@mmaietta Thanks for your time investigating and fixing it! Definitely, I'll take a look and try 6.1.9 soon! |
@mmaietta may i know which version of electron-updater might solve the above error ? |
@reddybhavanish [email protected] has the fix. |
Hi @mmaietta, i am still facing the error even after updating the [email protected], [email protected] and these are versions i am using "electron": "^26.2.0", |
@mmaietta any idea what might be causing the issue, the update is getting downloaded for the two consecutive latest version, facing the above error on the third attempt of testing auto update. |
That sounds like it may be a separate issue? Can you confirm your flow? From what I understand, you're attempting 3 update flows? i.e. canceling the first two updates and retrying a third time |
@mmaietta I am using bitbucket as provider. Is it something problem with my system or any cache of dependencies ? Please enlighten me. |
There are prebuild binaries. https://github.com/beyondkmp/win-verify-signature/releases/tag/v1.7.0
There are prebuild binaries in https://github.com/beyondkmp/win-verify-signature/releases/tag/v1.7.0. |
Trying to rule out electron-userland/electron-builder#7127
We've been getting a lot of these in Sentry, we are on: "electron-builder": "^24.13.3", |
Same here, and we are on :
|
Not sure if it is the same thing but we are getting lots of these as well:
where it fails to parse the unicode in the Windows user name |
@beyondkmp would you mind taking a look at this? The |
Using Electron updater and git hub provider for auto update. After the update downloaded from github, A JavaScript error message displayed.
[Window Title]
Error
[Main Instruction]
A JavaScript error occurred in the main process
[Content]
Uncaught Exception:
Error: Command failed: powershell.exe -NoProfile -NonInteractive -InputFormat None -Command Get-AuthenticodeSignature -LiteralPath 'C:\Users\Administrator\AppData\Local\testApp-updater\pending\temp-update.exe' | ConvertTo-Json -Compress | ForEach-Object { [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($_)) }
at ChildProcess.exithandler (node:child_process:406:12) at ChildProcess.emit (node:events:390:28) at maybeClose (node:internal/child_process:1064:16) at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
[OK]
This is occurring only in Windows thin clients. I couldn't able to reproduce in my windows laptop. I tried few other Windows laptops to test, but I couldn't able to reproduce it other than thin clients.
I tried to manually run this command to see, if there is any issue. but the command is executed fine without any error.
The text was updated successfully, but these errors were encountered: