Push nuget package to Github.com: The response ended prematurely.An error occurred while sending the request #24915
-
I’m trying to push NuGet packages to Github.com. I’ve successfully configured an action to build, test and push a .NET Standard package:
The package I’m trying to push now, is a multi-target nuget package, but that shouldn’t really matter. My workflow for this other package is the following:
So to build the package, I’m using MSBuild, but to push the package I’m still using the ordinary dotnet commands. The push to nuget.org works fine, but the push to Github.com fails with the following error:
Why is this push to my GitHub feed failing? |
Beta Was this translation helpful? Give feedback.
Replies: 15 comments
-
I’ve narrowed down the issue. I’m testing with the same repository, same code, same state. On each test, I’m incrementing the Nuget version of my package. Sometimes it succeeds in pushing to GPR, but most of the time it fails to push the new package. Pushing to nuget.org has never been a problem in my tests, Pushing to github.com sometimes works, but mostly fails. So what exactly is going on here? |
Beta Was this translation helpful? Give feedback.
-
In my case, the answer has been most of the time in the content of the |
Beta Was this translation helpful? Give feedback.
-
Thanks for the tip. However I removed the I have enabled diagnostic output and can see that the workflow actually pulls the github.token from the workflow, so authentication should also not be an issue. Successful push: Failed push: I also tried swapping the Github/Nuget push but the workflow still fails on PushGithub most of the time. |
Beta Was this translation helpful? Give feedback.
-
This appears to be an issue with jcansdale-test/NuGet.ClientClient Tools for NuGet - including Visual Studio extensions, command line tools, and msbuild support. (Open issues on https://github.com/nuget/home/issues) - jcansdale-test/NuGet.Client Bizarrely it does work with Could you try modifying your workflow to do this:
You should find this will work consistently. Please let me know how you get on! |
Beta Was this translation helpful? Give feedback.
-
Thanks for the response. I’ve tried using I have to note however that I’ve got a similar setup with a pure .NET Standard project, and this project has never given a problem building and pushing to nuget and GPR. I suspect that the issue is introduced when publishing a multi-target nuget package (I have no clue what could possibly cause this). I’ll keep you up-to-date if using nuget.exe works consistently. (6/6 successful pushes) |
Beta Was this translation helpful? Give feedback.
-
The chance of a Here is an example that shows pushes of various sized packages: jcansdale-test/nuget-push-testContribute to jcansdale-test/nuget-push-test development by creating an account on GitHub. By the time we get to a 2049 kB package, the push is almost certain to fail! |
Beta Was this translation helpful? Give feedback.
-
Interesting finding. I never had a problem pushing a .NET Standard nuget package to github.com/nuget.org. The problem started occuring by creating a multi-target nuget package. This implies that for each target, there’s a DLL in the package and increases the size of the package drastically. But how come the package can successfully be pushed to nuget.org all the time, while it fails for github.com, using the same command? Anyhow, using nuget.exe seems to work reliably. Thanks for the help. |
Beta Was this translation helpful? Give feedback.
-
PieterjanDeClippel:
It’s probably something to do with GitHub’s load balancer and they way chunked encoding works. The team will hopefully be digging into it soon! |
Beta Was this translation helpful? Give feedback.
-
This definitely has something to do with the size of the package. I have smaller packages that upload without issue but bigger ones fail with the above error message. It’s really really inconvenient and frustrating. |
Beta Was this translation helpful? Give feedback.
-
ckapatch:
I’ve written a GitHub Action based on https://github.com/jcansdale/gpr that you should find works consistently. You can use it like this:
Please let me know if you try it! |
Beta Was this translation helpful? Give feedback.
-
Great! Thanks. I’ll check this out. |
Beta Was this translation helpful? Give feedback.
-
Hi, thanks for this Github Action. Just note that if you build a dotnet package whit --include-symbols then it will upload each package two times and complain that its allready uploaded second time it gets uploaded. |
Beta Was this translation helpful? Give feedback.
-
I replaced
|
Beta Was this translation helpful? Give feedback.
-
Hello, we are seeing this issue with Nuget packages < 50 KB in size. It would be nice to avoid having to use the gpr push workaround. Do we know what the root cause for this failure is when using dotnet nuget push? There are no commas in my package description. |
Beta Was this translation helpful? Give feedback.
-
Hi @mtttcgcg,
mtttcgcg:
If you use the I hope that helps! |
Beta Was this translation helpful? Give feedback.
Hi @PieterjanDeClippel,
This appears to be an issue with
GitHubTransfer-Encoding: chunked
HTTP requests. I tried tweaking the NuGet source to not use chunked encoding and the push works every time!jcansdale-test/NuGet.Client
Client Tools for NuGet - including Visual Studio extensions, command line tools, and msbuild support. (Open issues on https://github.com/nuget/home/issues) - jcansdale-test/NuGet.Client
Bizarrely it does work with
nuget.exe
on the .NET framework, which also claims to useTransfer-Encoding: chunked
. My hunch is that this sends the payload as a single chunk.Could you try modifying your workflow to do this: