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

Unable to upload new package due to CONFLICT despite package not existing on api.nuget.org yet. #9886

Closed Mpdreamz closed 5 months ago

Mpdreamz commented 6 months ago

NuGet Product Used

dotnet.exe

Product Version

SDK 8

Worked before?

No response

Impact

I'm unable to use this version

Repro Steps & Context

We had an issue publishing a new package through:

dotnet nuget push '.artifacts/package/release/*.nupkg' -k ${REPO_API_KEY} --source ${REPO_API_URL} --skip-duplicate --no-symbols

REPO_API_URL: https://api.nuget.org/v3/index.json REPO_API_KEY: an API key that we use all the time that has full access to publish to Elastic.* and the account belongs to one with full access to the reserved Elastic.* prefix

See: https://github.com/elastic/elastic-otel-dotnet/actions/runs/8454527480/job/23163725827

Pushing Elastic.OpenTelemetry.1.0.0-alpha.1.nupkg to 'https://www.nuget.org/api/v2/package'...
  PUT https://www.nuget.org/api/v2/package/
  Conflict https://www.nuget.org/api/v2/package/ 449ms
Package '/home/runner/work/elastic-otel-dotnet/elastic-otel-dotnet/.artifacts/package/release/Elastic.OpenTelemetry.1.0.0-alpha.1.nupkg' already exists at feed 'https://www.nuget.org/api/v2/package'.

Which is strange because at the time: https://api.nuget.org/v3-flatcontainer/elastic.opentelemetry/index.json returned a BLOB not found.

In the end we had to resort to uploading the package manually through the gallery web UI and this worked without a hitch.

https://www.nuget.org/packages/Elastic.OpenTelemetry/1.0.0-alpha.1

However this breaks our provenance attestations.

We'll likely to another automated release soon so I will report back if this problem is isolated to the push of a new package.

Verbose Logs

No response

erdembayar commented 6 months ago

Thank you for filing this issue. Could please try repro with another version like Elastic.OpenTelemetry.1.0.0-alpha.2.nupkg from cli?

Mpdreamz commented 5 months ago

This time it did successfully upload: https://github.com/elastic/elastic-otel-dotnet/actions/runs/8611959810/job/23600150430#step:7:1

Although that does not explain away why we got a CONFLICT on the initial push.

erdembayar commented 5 months ago

@ryuyu Could you please look at in this based on latest info?

Mpdreamz commented 5 months ago

This appears to be due to the API Key organization not being correct, we have two (elastic/elasticsearch) and only one has the namespace reservation.