electron-builder: Error: Socket Hang up when electron-builder Release on github.
-
Version: 22.6.0
-
Electron Version:8.1.1
-
Electron Type (current, beta, nightly):Current
- Target: NSIS Windows
My electron-builder.json file for configurations
{
"appId": "com.screenshot.app",
"copyright": "Copyright © 2019-Tushar Kanjariya",
"productName": "Screenshot App",
"nsis": {
"perMachine": true,
"oneClick": false,
"allowToChangeInstallationDirectory": false,
"license": "LICENSE.txt",
"allowElevation": true
},
"publish": {
"provider": "github",
"owner": "TusharKanjariya",
"repo": "screenshot-app-electron",
"token": "my_token"
}
}
When I run the command npm run publish:github then the following error will occur after the final build and uploading

Plz, Help to solve my Issue.
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 17
- Comments: 85 (11 by maintainers)
Commits related to this issue
- fix(GitHubPublisher): add timeout to GitHub publisher uploads prevent socket hand up due to short timeout default setting fixes #4940 fix(GitHubPublisher): add timeout to GitHub publisher uploads ... — committed to Kellojo/electron-builder by Kellojo 3 years ago
- revert to older version of electron-builder the latest versions won't replace an existing release file and fail with asset_already_exists https://github.com/electron-userland/electron-builder/issues/... — committed to molabsai/mo-desktop by holic 3 years ago
GitHub’s official
actions/upload-artifactseems to resolve this issue by adding retries:https://github.com/actions/upload-artifact/issues/116#issuecomment-754141048
I’m still seeing this on an electron project I work on. When we run parallel windows and Mac builds on GH actions that publishes to GH releases, it seems to fail about 60% of the time with this error.
We’ve since switched to serialized builds and haven’t encountered the issue anymore, but it would be nice to have parallel builds again.
You are absolutely right, it has only been randomly failing when I had a draft matching the same version. Now I have increased the version, it does no longer match the draft’s version so it now doesn’t randomly fail anymore
I have these observations from trying to debug this locally:
ifblock whereoverwriteArtifactis calledhttps://github.com/electron-userland/electron-builder/blob/00e49e476ab103028d3e8d2543e34c041bc72878/packages/electron-publish/src/gitHubPublisher.ts#L200-L202
e.description.errors[0].codein the if statement is undefined sincee.descriptionhas not been parsed into an object.I’ll continue experimenting and debugging, and try and come up with a PR to fix at least this portion of these errors
the description we get back is like:
same issue here, we are experiencing this error on-off for months 😦
I’ve noticed something else: it doesn’t fail at the times my draft release is empty, i.e., when there is no need to overwrite files. Looking at all the examples you folks posted here, they all are trying to overwrite files. Is it possible that a change in GitHub API is the root cause?
Well I tried like 10 times now and it seems always the same.
Can also confirm that this is still an issue, and yes, only occurs if the version tag already exists (i.e. it is overwriting a file).
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
I’m trying to debug the issue at version 22.11.7 using the strategy of patching the
electron-publishpackage. I’m runningelectron-builderusing GitHub Actions. This is the error thrown:I am wondering what the issue could be, if it’s not the timeout. Magically my builds now work again without any issues…
Have you tried that timeout change yet, by chance? Here’s a quick patch to apply that change for v22.10.5 in case anyone else interested. If it works, then I’m happy to incorporate the change
Publishing is almost unusable. It is falling for me at a ratio of around one successful upload to five failed ones.
Hello 🖖🏻
I am also facing this issue since some weeks ago. I now always to re-run the Github Actions until it works.
https://github.com/Graviton-Code-Editor/Graviton-App/runs/1140459243?check_suite_focus=true
Notes:
Question - how long does the upload take? This sort of error is something I’ve encountered elsewhere on long uploads