NuGet / NuGetGallery

NuGet Gallery is a package repository that powers https://www.nuget.org. Use this repo for reporting NuGet.org issues.
https://www.nuget.org/
Apache License 2.0
1.54k stars 643 forks source link

Can't push to Azure hosted gallery #9850

Closed FraserElectronics closed 5 months ago

FraserElectronics commented 6 months ago

Impact

I'm unable to use this version

Describe the bug

I have built a self hosted gallery using the instructions here: https://learn.microsoft.com/en-us/nuget/hosting-packages/nuget-server

If I build and run this locally, I can push packages to it fine.

When I deploy to a WebApp on Azure it shows the URLs for package sources and how to push to the repo using the command line tools but when I enter the command :

nuget.exe push MyExtensions.1.0.1.nupkg MyAPIKey -Source https://mynugetserver.azurewebsites.net/nuget

I get the following error:

Pushing MyExtensions.1.0.1.nupkg to 'https://mynugetserver.azurewebsites.net/nuget'...
  PUT https://mynugetserver.azurewebsites.net/nuget/
  NotFound https://mynugetserver.azurewebsites.net/nuget/ 266ms
Response status code does not indicate success: 404 (Not Found).

Can anyone help?

Andy

Repro Steps

See above.

Expected Behavior

I should get a successful push.

Screenshots

No response

Additional Context and logs

No response

skofman1 commented 6 months ago

@FraserElectronics, thanks for reaching out. I think the problem here is with the Source URL. When pushing to nuget.org, the URL will be https://www.nuget.org/api/v2/package, so it should be similar for your private deployment as well. You can try https://mynugetserver.azurewebsites.net/api/v2/package .

FraserElectronics commented 6 months ago

@skofman1 Thanks for your help - your suggestion has moved me forward but I now get the following error when try and push any nuget package.

nuget push MyExtensions.1.0.2.nupkg MyAPIKey -Source https://mynugetserver.azurewebsites.net/api/v2/package
Pushing MyExtensions.1.0.2.nupkg to 'https://mynugetserver.azurewebsites.net/api/v2/package'...
  PUT https://mynugetserver.azurewebsites.net/api/v2/package/
  InternalServerError https://mynugetserver.azurewebsites.net/api/v2/package/ 451ms
  PUT https://mynugetserver.azurewebsites.net/api/v2/package/
  InternalServerError https://mynugetserver.azurewebsites.net/api/v2/package/ 192ms
  PUT https://mynugetserver.azurewebsites.net/api/v2/package/
  InternalServerError https://mynugetserver.azurewebsites.net/api/v2/package/ 194ms
Response status code does not indicate success: 500 (The remote server returned an error: (409) Conflict.).

Andy

erdembayar commented 6 months ago

The remote server returned an error: (409) Conflict

That indicates your package was already published in one of your previous attempts. Please create a new version MyExtensions.1.0.99.nupkg and then try to publish it.

FraserElectronics commented 6 months ago

@erdembayar I had already tried pushing multiple packages that would not be there but still got the same problem. I also increased the version number of one package and that still gives the 409 Conflict error .

Andy

erdembayar commented 6 months ago

It looks like you're leveraging the NuGet.Server package, but it was created before I joined the team and I'm not sure of its current status. I'll figure it out and let you know if it's still supported.

erdembayar commented 5 months ago

Package in question: https://www.nuget.org/stats/packages/NuGet.Server?groupby=Version&groupby=ClientName

erdembayar commented 5 months ago

@FraserElectronics Please move to one of the offerings here: https://learn.microsoft.com/en-us/nuget/hosting-packages/overview Fyi BaGet and Sleet are both popular alternatives, but above NuGet.Server, which is for V2 feed implementation (not the latest V3), has not been updated for a long time.

FraserElectronics commented 5 months ago

@erdembayar Okay, thanks for those references, I will have a look at them 👍