NuGet / Home

Repo for NuGet Client issues
Other
1.5k stars 252 forks source link

API key not detected when pushing causing version conflict #5473

Open aiham opened 7 years ago

aiham commented 7 years ago

Details about Problem

NuGet product used (NuGet.exe | VS UI | Package Manager Console | dotnet.exe): nuget

NuGet version (x.x.x.xxx): 4.1.0.2450

OS version (i.e. win10 v1607 (14393.321)): macOS Sierra 10.12.5

Detailed repro steps so we can see the same problem

  1. Ensure nuget API key is NOT set (or it may require an invalid API key to be set)

  2. Modify the version of your package to one that's unused

  3. nuget pack

  4. nuget push

  5. Observe auth error

  6. Set nuget API key

  7. nuget push

  8. Observe version conflict

...

Other suggested things

I believe this is a security issue. This means I as an unauthorised individual can deny any package a particular version number, right?

Verbose Logs

Please include verbose logs (NuGet.exe -verbosity detailed | dotnet.exe --verbosity diag | etc...)

Push with auth error:

$ nuget push OpenTok.2.4.1.nupkg -Source https://www.nuget.org/api/v2/package -Verbosity detailed
NuGet Version: 4.1.0.2450
Pushing OpenTok.2.4.1.nupkg to 'https://www.nuget.org/api/v2/package'...
  PUT https://www.nuget.org/api/v2/package/
  Created https://www.nuget.org/api/v2/package/ 12281ms
Your package was pushed.
WARNING: Found symbols package 'OpenTok.2.4.1.symbols.nupkg', but no API key was specified for the symbol server. To save an API Key, run 'NuGet.exe setApiKey [your API key from http://www.NuGet.org]'.
WARNING: No API Key was provided and no API Key could be found for the symbol server (https://nuget.smbsrc.net/). To save an API Key for a source use the 'setApiKey' command.
Pushing OpenTok.2.4.1.symbols.nupkg to the symbol server (https://nuget.smbsrc.net/)...
  PUT https://nuget.smbsrc.net/api/v2/package/
Please provide credentials for: https://www.nuget.org/api/v2/package
UserName: TokBox
Password: *************
Please provide credentials for: https://www.nuget.org/api/v2/package
UserName: tokbox
Password: *************
Please provide credentials for: https://www.nuget.org/api/v2/package
UserName: tokbox
Password: *************
Please provide credentials for: https://www.nuget.org/api/v2/package
UserName: TokBox
Password: *************
  Unauthorized https://nuget.smbsrc.net/api/v2/package/ 267901ms
An error was encountered when fetching 'PUT https://nuget.smbsrc.net/'. The request will now be retried.
401 (Must authenticate)
  PUT https://nuget.smbsrc.net/api/v2/package/
  Unauthorized https://nuget.smbsrc.net/api/v2/package/ 592ms
An error was encountered when fetching 'PUT https://nuget.smbsrc.net/'. The request will now be retried.
401 (Must authenticate)
  PUT https://nuget.smbsrc.net/api/v2/package/
  Unauthorized https://nuget.smbsrc.net/api/v2/package/ 594ms
System.AggregateException: One or more errors occurred. ---> System.Net.Http.HttpRequestException: 401 (Must authenticate)
  at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode () [0x0002a] in <68ba4a0a54764b819b8b058de1b791f4>:0
  at NuGet.Protocol.Core.Types.PackageUpdateResource+<>c.<PushPackageToServer>b__21_1 (System.Net.Http.HttpResponseMessage response) [0x00000] in <d0f788a4af354971807e5d8ca6fc682e>:0
  at NuGet.Protocol.HttpSource+<ProcessResponseAsync>d__14`1[T].MoveNext () [0x000da] in <d0f788a4af354971807e5d8ca6fc682e>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at NuGet.Protocol.Core.Types.PackageUpdateResource+<PushPackageToServer>d__21.MoveNext () [0x002f1] in <d0f788a4af354971807e5d8ca6fc682e>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at NuGet.Protocol.Core.Types.PackageUpdateResource+<PushPackageCore>d__15.MoveNext () [0x00181] in <d0f788a4af354971807e5d8ca6fc682e>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at NuGet.Protocol.Core.Types.PackageUpdateResource+<PushPackage>d__14.MoveNext () [0x0011d] in <d0f788a4af354971807e5d8ca6fc682e>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at NuGet.Protocol.Core.Types.PackageUpdateResource+<PushSymbols>d__12.MoveNext () [0x000f8] in <d0f788a4af354971807e5d8ca6fc682e>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at NuGet.Protocol.Core.Types.PackageUpdateResource+<Push>d__10.MoveNext () [0x001ae] in <d0f788a4af354971807e5d8ca6fc682e>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at NuGet.Commands.PushRunner+<Run>d__0.MoveNext () [0x0028b] in <d0f788a4af354971807e5d8ca6fc682e>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at NuGet.CommandLine.PushCommand+<ExecuteCommandAsync>d__28.MoveNext () [0x001b0] in <d0f788a4af354971807e5d8ca6fc682e>:0
   --- End of inner exception stack trace ---
  at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00011] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Threading.Tasks.Task.Wait (System.Int32 millisecondsTimeout, System.Threading.CancellationToken cancellationToken) [0x00043] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Threading.Tasks.Task.Wait () [0x00000] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at NuGet.CommandLine.Command.Execute () [0x000bd] in <d0f788a4af354971807e5d8ca6fc682e>:0
  at NuGet.CommandLine.Program.MainCore (System.String workingDirectory, System.String[] args) [0x001f3] in <d0f788a4af354971807e5d8ca6fc682e>:0
---> (Inner Exception #0) System.Net.Http.HttpRequestException: 401 (Must authenticate)
  at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode () [0x0002a] in <68ba4a0a54764b819b8b058de1b791f4>:0
  at NuGet.Protocol.Core.Types.PackageUpdateResource+<>c.<PushPackageToServer>b__21_1 (System.Net.Http.HttpResponseMessage response) [0x00000] in <d0f788a4af354971807e5d8ca6fc682e>:0
  at NuGet.Protocol.HttpSource+<ProcessResponseAsync>d__14`1[T].MoveNext () [0x000da] in <d0f788a4af354971807e5d8ca6fc682e>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at NuGet.Protocol.Core.Types.PackageUpdateResource+<PushPackageToServer>d__21.MoveNext () [0x002f1] in <d0f788a4af354971807e5d8ca6fc682e>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at NuGet.Protocol.Core.Types.PackageUpdateResource+<PushPackageCore>d__15.MoveNext () [0x00181] in <d0f788a4af354971807e5d8ca6fc682e>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at NuGet.Protocol.Core.Types.PackageUpdateResource+<PushPackage>d__14.MoveNext () [0x0011d] in <d0f788a4af354971807e5d8ca6fc682e>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at NuGet.Protocol.Core.Types.PackageUpdateResource+<PushSymbols>d__12.MoveNext () [0x000f8] in <d0f788a4af354971807e5d8ca6fc682e>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at NuGet.Protocol.Core.Types.PackageUpdateResource+<Push>d__10.MoveNext () [0x001ae] in <d0f788a4af354971807e5d8ca6fc682e>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at NuGet.Commands.PushRunner+<Run>d__0.MoveNext () [0x0028b] in <d0f788a4af354971807e5d8ca6fc682e>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at NuGet.CommandLine.PushCommand+<ExecuteCommandAsync>d__28.MoveNext () [0x001b0] in <d0f788a4af354971807e5d8ca6fc682e>:0 <---

Set API KEY:

$ nuget setApiKey REDACTED_API_KEY -source https://www.nuget.org
The API Key 'REDACTED_API_KEY' was saved for the NuGet gallery (https://www.nuget.org).

Version conflict:

$ nuget push OpenTok.2.4.1.nupkg -Source https://www.nuget.org/api/v2/package -Verbosity detailed
NuGet Version: 4.1.0.2450
Pushing OpenTok.2.4.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/ 1671ms
System.AggregateException: One or more errors occurred. ---> System.Net.Http.HttpRequestException: 409 (A package with ID 'OpenTok' and version '2.4.1' already exists and cannot be modified.)
  at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode () [0x0002a] in <68ba4a0a54764b819b8b058de1b791f4>:0
  at NuGet.Protocol.Core.Types.PackageUpdateResource+<>c.<PushPackageToServer>b__21_3 (System.Net.Http.HttpResponseMessage response) [0x00000] in <d0f788a4af354971807e5d8ca6fc682e>:0
  at NuGet.Protocol.HttpSource+<ProcessResponseAsync>d__14`1[T].MoveNext () [0x000da] in <d0f788a4af354971807e5d8ca6fc682e>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at NuGet.Protocol.Core.Types.PackageUpdateResource+<PushPackageToServer>d__21.MoveNext () [0x00451] in <d0f788a4af354971807e5d8ca6fc682e>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at NuGet.Protocol.Core.Types.PackageUpdateResource+<PushPackageCore>d__15.MoveNext () [0x00181] in <d0f788a4af354971807e5d8ca6fc682e>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at NuGet.Protocol.Core.Types.PackageUpdateResource+<PushPackage>d__14.MoveNext () [0x0011d] in <d0f788a4af354971807e5d8ca6fc682e>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at NuGet.Protocol.Core.Types.PackageUpdateResource+<Push>d__10.MoveNext () [0x000fd] in <d0f788a4af354971807e5d8ca6fc682e>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at NuGet.Commands.PushRunner+<Run>d__0.MoveNext () [0x0028b] in <d0f788a4af354971807e5d8ca6fc682e>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at NuGet.CommandLine.PushCommand+<ExecuteCommandAsync>d__28.MoveNext () [0x001b0] in <d0f788a4af354971807e5d8ca6fc682e>:0
   --- End of inner exception stack trace ---
  at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00011] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Threading.Tasks.Task.Wait (System.Int32 millisecondsTimeout, System.Threading.CancellationToken cancellationToken) [0x00043] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Threading.Tasks.Task.Wait () [0x00000] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at NuGet.CommandLine.Command.Execute () [0x000bd] in <d0f788a4af354971807e5d8ca6fc682e>:0
  at NuGet.CommandLine.Program.MainCore (System.String workingDirectory, System.String[] args) [0x001f3] in <d0f788a4af354971807e5d8ca6fc682e>:0
---> (Inner Exception #0) System.Net.Http.HttpRequestException: 409 (A package with ID 'OpenTok' and version '2.4.1' already exists and cannot be modified.)
  at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode () [0x0002a] in <68ba4a0a54764b819b8b058de1b791f4>:0
  at NuGet.Protocol.Core.Types.PackageUpdateResource+<>c.<PushPackageToServer>b__21_3 (System.Net.Http.HttpResponseMessage response) [0x00000] in <d0f788a4af354971807e5d8ca6fc682e>:0
  at NuGet.Protocol.HttpSource+<ProcessResponseAsync>d__14`1[T].MoveNext () [0x000da] in <d0f788a4af354971807e5d8ca6fc682e>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at NuGet.Protocol.Core.Types.PackageUpdateResource+<PushPackageToServer>d__21.MoveNext () [0x00451] in <d0f788a4af354971807e5d8ca6fc682e>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at NuGet.Protocol.Core.Types.PackageUpdateResource+<PushPackageCore>d__15.MoveNext () [0x00181] in <d0f788a4af354971807e5d8ca6fc682e>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at NuGet.Protocol.Core.Types.PackageUpdateResource+<PushPackage>d__14.MoveNext () [0x0011d] in <d0f788a4af354971807e5d8ca6fc682e>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at NuGet.Protocol.Core.Types.PackageUpdateResource+<Push>d__10.MoveNext () [0x000fd] in <d0f788a4af354971807e5d8ca6fc682e>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at NuGet.Commands.PushRunner+<Run>d__0.MoveNext () [0x0028b] in <d0f788a4af354971807e5d8ca6fc682e>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <ffb99659fc1c47faa4d5f883014d08aa>:0
  at NuGet.CommandLine.PushCommand+<ExecuteCommandAsync>d__28.MoveNext () [0x001b0] in <d0f788a4af354971807e5d8ca6fc682e>:0 <---
aiham commented 7 years ago

I think I am hitting the same issue as #5468

aiham commented 7 years ago

Even though I set my api key:

$ nuget setApiKey REDACTED_API_KEY -source https://www.nuget.org
The API Key 'REDACTED_API_KEY' was saved for the NuGet gallery (https://www.nuget.org).

It's not being detected:

$ nuget push OpenTok.2.4.2.nupkg -Source https://www.nuget.org/api/v2/package -Verbosity detailed
NuGet Version: 4.1.0.2450
Pushing OpenTok.2.4.2.nupkg to 'https://www.nuget.org/api/v2/package'...
  PUT https://www.nuget.org/api/v2/package/
  Created https://www.nuget.org/api/v2/package/ 11000ms
Your package was pushed.
WARNING: Found symbols package 'OpenTok.2.4.2.symbols.nupkg', but no API key was specified for the symbol server. To save an API Key, run 'NuGet.exe setApiKey [your API key from http://www.NuGet.org]'.
WARNING: No API Key was provided and no API Key could be found for the symbol server (https://nuget.smbsrc.net/). To save an API Key for a source use the 'setApiKey' command.
Pushing OpenTok.2.4.2.symbols.nupkg to the symbol server (https://nuget.smbsrc.net/)...
  PUT https://nuget.smbsrc.net/api/v2/package/
Please provide credentials for: https://www.nuget.org/api/v2/package
UserName: An error was encountered when fetching 'PUT https://nuget.smbsrc.net/'. The request will now be retried.
The HTTP request to 'PUT https://nuget.smbsrc.net/api/v2/package/' has timed out after 300000ms.
  PUT https://nuget.smbsrc.net/api/v2/package/
System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> System.Threading.Tasks.TaskCanceledException: A task was canceled.
aiham commented 7 years ago

Turns out the package was published successfully and now we have multiple redundant versions:

https://www.nuget.org/packages/OpenTok/2.4.0 https://www.nuget.org/packages/OpenTok/2.4.1 https://www.nuget.org/packages/OpenTok/2.4.2 https://www.nuget.org/packages/OpenTok/2.4.3

aiham commented 7 years ago

As you can see from the CLI output above there was no indication of a successful publish.

elsand commented 2 years ago

This has bit me a couple of times as well. In my case using an expired API-key causes the push to fail with a 403 error. Refreshing the key and pushing again the same packaged causes a 409 error, indicating that the particular version has already been pushed.

I am now unable to push v2.1.0 of https://www.nuget.org/packages/Altinn.ApiClients.Dan because nuget.org claims it already exists, even though there is no sign of that version anywhere.