Skip to content

Error when using private MyGet feed and pre-authenticated url #424

Closed

Description

@troyschneringer

In my nuget config I've added a private myget feed:

<add key="[FEEDNAME]" value="https://www.myget.org/F/[FEEDNAME]/auth/[TOKEN]/api/v2" />

When I add a package from that feed in the project.json it doesn't resolve in Visual Studio. If I run a kpm restore it resolves against the pre-authenticated url successfully. It then attempts to resolve against the non-authenticated url 3 times, each failing with a 401 and ultimately failing the restore. Here's the output:

C:\source\src\[PROJECT] [master +0 ~2 -0]> kpm restore
Restoring packages for C:\source\src\[PROJECT]\project.json
  CACHE https://www.myget.org/F/aspnetmaster/api/v2/FindPackagesById()?Id='[PACKAGENAME]'
  CACHE https://www.nuget.org/api/v2/FindPackagesById()?Id='[PACKAGENAME]'
  GET https://www.myget.org/F/[FEEDNAME]/auth/[TOKEN]/api/v2/FindPackagesById()?Id='[PACKAGENAME]'.
  OK https://www.myget.org/F/[FEEDNAME]/auth/[TOKEN]/api/v2/FindPackagesById()?Id='[PACKAGENAME]' 49469ms
  GET https://www.myget.org/F/[FEEDNAME]/api/v2/package/[PACKAGENAME]/0.0.1.
Warning: DownloadPackageAsync: https://www.myget.org/F/[FEEDNAME]/api/v2/package/[PACKAGENAME]/0.0.1
  Response status code does not indicate success: 401 (Unauthorized).
  GET https://www.myget.org/F/[FEEDNAME]/api/v2/package/[PACKAGENAME]/0.0.1.
Warning: DownloadPackageAsync: https://www.myget.org/F/[FEEDNAME]/api/v2/package/[PACKAGENAME]/0.0.1
  Response status code does not indicate success: 401 (Unauthorized).
  GET https://www.myget.org/F/[FEEDNAME]/api/v2/package/[PACKAGENAME]/0.0.1.
Error: DownloadPackageAsync: https://www.myget.org/F/[FEEDNAME]/api/v2/package/[PACKAGENAME]/0.0.1
  Response status code does not indicate success: 401 (Unauthorized).
----------
System.ArgumentNullException: Value cannot be null.
Parameter name: stream
   at System.IO.Compression.ZipArchive..ctor(Stream stream, ZipArchiveMode mode, Boolean leaveOpen, Encoding entryNameEncoding)
   at Microsoft.Framework.PackageManager.PackageUtilities.<OpenNuspecStreamFromNupkgAsync>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Framework.PackageManager.Restore.NuGet.NuGetv2Feed.<OpenNuspecStreamAsync>d__23.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Framework.PackageManager.RemoteWalkProvider.<GetDependencies>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Framework.PackageManager.RestoreOperations.<FindLibraryEntry>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Framework.PackageManager.RestoreOperations.<CreateGraphNode>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Microsoft.Framework.PackageManager.RestoreOperations.<CreateGraphNode>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Microsoft.Framework.PackageManager.RestoreCommand.<RestoreForProject>d__62.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Framework.PackageManager.RestoreCommand.<ExecuteCommand>d__61.MoveNext()
----------
Restore failed
Value cannot be null.
Parameter name: stream

Activity

  1. Praburaj commented on Mar 31, 2015

    @Praburaj

    Can you try adding this to your Nuget.config and retry?

    <packageSources>
    <add key="[FEEDNAME]" value="..." />
    </packageSources>
    <packageSourceCredentials>
    <FEEDNAME>
    <add key="Username" value="username" />
    <add key="ClearTextPassword" value="passwordhere" />
    </FEEDNAME>
    </packageSourceCredentials>
    
  2. troyschneringer commented on Apr 9, 2015

    @troyschneringer
    Author

    That does work, however I'd prefer not to have my password in plain text and the pre-authenticated url seemed to be the best approach for that.

  3. aspnet-hello commented on Dec 31, 2017

    @aspnet-hello

    This issue is being closed because it has not been updated in 3 months.

    We apologize if this causes any inconvenience. We ask that if you are still encountering this issue, please log a new issue with updated information and we will investigate.

  4. added a commit that references this issue on Nov 19, 2018
  5. ghost locked as resolved and limited conversation to collaborators on Dec 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions