Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nexus 3: Fails get packages from feed with credentials #1941

Closed
WebDucer opened this issue Oct 6, 2016 · 6 comments
Closed

Nexus 3: Fails get packages from feed with credentials #1941

WebDucer opened this issue Oct 6, 2016 · 6 comments

Comments

@WebDucer
Copy link

WebDucer commented Oct 6, 2016

Description

We use Sonatype Nexus 3 repository (Docker container sonatype/docker-nexus3) as our private repository. This is accessable from internet. Because of this, the access is limited to only registered users. The anonymous access is switched off (Administration panel -> Security -> Anonymous -> Allow anonymous users to access the server unchecked).

source "http://<your-nexus-repo>/repository/nuget-group/"

nuget Newtonsoft.Json

The resolution with .paket\paket update fails. Credentials are stored in configuration. Access from Visual Studio and Xamarin Studio (macOS) nuget manager works without problems with the same credentials.

Resolution with activated anonymous access works also without problems with paket.

Repro steps

  1. Create the default Deocker container for Nexus 3 (nuget-group is already configured)
  2. Add new user, that cann search and brows nuget repository
    • nx-search-read
    • nx-repository-view-*-*-read
    • nx-repository-view-*-*-browse
  3. Disable anonymous access for Nexus 3
  4. Add credentials for the new user to paket configuration with:
    .paket\paket config add-creadentials http://<your-nexus-repo>/repository/nuget-group/
  5. Fix the config file with ending / for the source (this is truncated with the config command). Without this fix, the login fails.
  6. Execute .paket\paket update for paket.dependencies that has Nexus 3 repo as source (like above)

Expected behavior

Paket resolve the needed nuget package over nexus repository.

Actual behavior

Resolution stops with the following error:

c:\Temp\PaketTest>.paket\paket.exe update
Paket version 3.21.2.0
Resolving packages for group Main:
Paket failed with:
        Could not find versions for package Newtonsoft.Json on http://<your-nexus-repo>/repository/nuget-group.

With verbose output (.paket\paket update -v):

c:\Temp\PaketTest>.paket\paket.exe update -v
Paket version 3.21.2.0
found: c:\Temp\PaketTest\paket.dependencies
Parsing c:\Temp\PaketTest\paket.dependencies
Resolving packages for group Main:
  0 packages in resolution. 2 requirements left
  Trying to resolve Newtonsoft.Json  (from c:\Temp\PaketTest\paket.dependencies)
  - fetching versions for Newtonsoft.Json
getAllVersionsFromNugetODataWithFilter from url 'http://<your-nexus-repo>/repository/nuget-group/Packages?$filter=tolower(Id) eq 'newtonsoft.json''
getAllVersionsFromNugetOData from url 'http://<your-nexus-repo>/repository/nuget-group/FindPackagesById()?id='Newtonsoft.Json''
Error while retrieving 'http://<your-nexus-repo>/repository/nuget-group/package-versions/Newtonsoft.Json?includePrerelease=true': System.AggregateException: Mindestens ein Fehler ist aufgetreten. ---> System.Net.WebException: Der Remoteserver hat einen Fehler zurückgegeben: (401) Nicht autorisiert.
   bei System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   bei System.Net.WebClient.GetWebResponse(WebRequest request, IAsyncResult result)
   bei System.Net.WebClient.DownloadBitsResponseCallback(IAsyncResult result)
   --- Ende der internen Ausnahmestapelüberwachung ---
---> (Interne Ausnahme #0) System.Net.WebException: Der Remoteserver hat einen Fehler zurückgegeben: (401) Nicht autorisiert.
   bei System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   bei System.Net.WebClient.GetWebResponse(WebRequest request, IAsyncResult result)
   bei System.Net.WebClient.DownloadBitsResponseCallback(IAsyncResult result)<---

getAllVersionsFromNugetODataWithFilter from url 'http://<your-nexus-repo>/repository/nuget-group/Packages?$filter=tolower(Id) eq 'newtonsoft.json''
getAllVersionsFromNugetOData from url 'http://<your-nexus-repo>/repository/nuget-group/FindPackagesById()?id='Newtonsoft.Json''
Error while retrieving 'http://<your-nexus-repo>/repository/nuget-group/package-versions/Newtonsoft.Json?includePrerelease=true': System.AggregateException: Mindestens ein Fehler ist aufgetreten. ---> System.Net.WebException: Der Remoteserver hat einen Fehler zurückgegeben: (401) Nicht autorisiert.
   bei System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   bei System.Net.WebClient.GetWebResponse(WebRequest request, IAsyncResult result)
   bei System.Net.WebClient.DownloadBitsResponseCallback(IAsyncResult result)
   --- Ende der internen Ausnahmestapelüberwachung ---
---> (Interne Ausnahme #0) System.Net.WebException: Der Remoteserver hat einen Fehler zurückgegeben: (401) Nicht autorisiert.
   bei System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   bei System.Net.WebClient.GetWebResponse(WebRequest request, IAsyncResult result)
   bei System.Net.WebClient.DownloadBitsResponseCallback(IAsyncResult result)<---

Paket failed with:
        Could not find versions for package Newtonsoft.Json on http://<your-nexus-repo>/repository/nuget-group.
StackTrace:
     bei [email protected](String message)
   bei Paket.NuGetV2.GetVersions(Boolean force, String root, IEnumerable`1 sources, PackageName packageName)
   bei [email protected](ResolverStrategy resolverStrategy, GroupName groupName, PackageName packageName)
   bei Paket.UpdateProcess.getSortedAndCachedVersionsF@15(FSharpFunc`2 getSortedVersionsF, Dictionary`2 allVersions, FSharpList`1 sources, ResolverStrategy resolverStrategy, GroupName groupName, PackageName packageName)
   bei [email protected](IEnumerable`1& next)
   bei Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.MoveNextImpl()
   bei Microsoft.FSharp.Collections.SeqModule.oneStepTo@1402[T](IEnumerable`1 source, List`1 prefix, FSharpRef`1 enumeratorR, Int32 i)
   bei Microsoft.FSharp.Collections.SeqModule.f@4728-2[T](IEnumerable`1 source, List`1 prefix, FSharpRef`1 enumeratorR, Int32 i, Unit unitVar0)
   bei [email protected](Int32 i)
   bei [email protected](b& )
   bei Microsoft.FSharp.Collections.IEnumerator.MapEnumerator`1.System-Collections-IEnumerator-MoveNext()
   bei Microsoft.FSharp.Collections.SeqModule.oneStepTo@1402[T](IEnumerable`1 source, List`1 prefix, FSharpRef`1 enumeratorR, Int32 i)
   bei Microsoft.FSharp.Collections.SeqModule.f@4728-2[T](IEnumerable`1 source, List`1 prefix, FSharpRef`1 enumeratorR, Int32 i, Unit unitVar0)
   bei [email protected](Int32 i)
   bei [email protected](b& )
   bei Microsoft.FSharp.Collections.IEnumerator.MapEnumerator`1.System-Collections-IEnumerator-MoveNext()
   bei Microsoft.FSharp.Collections.IEnumerator.next@224[T](FSharpFunc`2 f, IEnumerator`1 e, FSharpRef`1 started, Unit unitVar0)
   bei Microsoft.FSharp.Collections.IEnumerator.filter@219.System-Collections-IEnumerator-MoveNext()
   bei Microsoft.FSharp.Collections.SeqModule.oneStepTo@1402[T](IEnumerable`1 source, List`1 prefix, FSharpRef`1 enumeratorR, Int32 i)
   bei Microsoft.FSharp.Collections.SeqModule.f@4728-2[T](IEnumerable`1 source, List`1 prefix, FSharpRef`1 enumeratorR, Int32 i, Unit unitVar0)
   bei [email protected](Int32 i)
   bei [email protected](b& )
   bei Microsoft.FSharp.Collections.IEnumerator.MapEnumerator`1.System-Collections-IEnumerator-MoveNext()
   bei Microsoft.FSharp.Collections.SeqModule.IsEmpty[T](IEnumerable`1 source)
   bei Paket.PackageResolver.getCompatibleVersions$cont@346(GroupName groupName, FSharpOption`1 globalStrategyForTransitives, FSharpOption`1 globalStrategyForDirectDependencies, FSharpFunc`2 getVersionsF, ResolverStep currentStep, PackageRequirement currentRequirement, FSharpRef`1 availableVersions, FSharpRef`1 compatibleVersions, FSharpRef`1 globalOverride, Unit unitVar)
   bei Paket.PackageResolver.getCompatibleVersions@337(GroupName groupName, FSharpOption`1 globalStrategyForTransitives, FSharpOption`1 globalStrategyForDirectDependencies, FSharpFunc`2 getVersionsF, FSharpRef`1 tryRelaxed, ResolverStep currentStep, PackageRequirement currentRequirement)
   bei Paket.PackageResolver.step@479(UpdateMode updateMode, GroupName groupName, FSharpOption`1 globalStrategyForTransitives, FSharpOption`1 globalStrategyForDirectDependencies, FrameworkRestrictions globalFrameworkRestrictions, FSharpFunc`2 getVersionsF, FSharpFunc`2 getPackageDetailsF, FSharpRef`1 lastConflictReported, FSharpOption`1 packageFilter, IDictionary`2 rootSettings, Dictionary`2 exploredPackages, Dictionary`2 conflictHistory, HashSet`1 knownConflicts, FSharpRef`1 tryRelaxed, ResolverStep currentStep)
   bei Paket.PackageResolver.Resolve(FSharpFunc`2 getVersionsF, FSharpFunc`2 getPackageDetailsF, GroupName groupName, FSharpOption`1 globalStrategyForDirectDependencies, FSharpOption`1 globalStrategyForTransitives, FrameworkRestrictions globalFrameworkRestrictions, FSharpSet`1 rootDependencies, UpdateMode updateMode)
   bei <StartupCode$Paket-Core>[email protected](GroupName groupName, b _arg1)
   bei Microsoft.FSharp.Collections.MapTreeModule.mapiOpt[a,b,c](FSharpFunc`3 f, MapTree`2 m)
   bei Microsoft.FSharp.Collections.FSharpMap`2.Map[b](FSharpFunc`2 f)
   bei Paket.UpdateProcess.selectiveUpdate(Boolean force, FSharpFunc`2 getSha1, FSharpFunc`2 getSortedVersionsF, FSharpFunc`2 getPackageDetailsF, LockFile lockFile, DependenciesFile dependenciesFile, UpdateMode updateMode, SemVerUpdateMode semVerUpdateMode)
   bei Paket.UpdateProcess.SelectiveUpdate(DependenciesFile dependenciesFile, UpdateMode updateMode, SemVerUpdateMode semVerUpdateMode, Boolean force)
   bei Paket.UpdateProcess.SmartInstall(DependenciesFile dependenciesFile, UpdateMode updateMode, UpdaterOptions options)
   bei <StartupCode$Paket-Core>[email protected](Unit unitVar0)
   bei Paket.Utils.RunInLockedAccessMode[a](String rootFolder, FSharpFunc`2 action)
   bei [email protected](ParseResults`1 results)
   bei Paket.Program.processWithValidation[T](Boolean silent, FSharpFunc`2 validateF, FSharpFunc`2 commandF, ParseResults`1 result)
   bei Paket.Program.main$cont@380(ParseResults`1 results, Boolean silent, Unit unitVar)
   bei Paket.Program.main()

Known workarounds

No known workarounds.

@WebDucer
Copy link
Author

WebDucer commented Oct 6, 2016

I tried to pass the credentials direct in the source definition of paket.dependencies with the same result.

source "http://<your-nexus-repo>/repository/nuget-group/" username: "<user>" password: "<password>"

nuget Newtonsoft.Json

@forki
Copy link
Member

forki commented Oct 6, 2016

do you have a public container running somewhere for me to test? I thought we already made that work couple of versions ago

@WebDucer
Copy link
Author

WebDucer commented Oct 6, 2016

@forki I can create a new user for you to be able to connect to our repo (accessable from net). How can I send you the credentials? Github has no PM any more.

@forki
Copy link
Member

forki commented Oct 6, 2016

Sforkmann at gmail.

Thx

forki added a commit that referenced this issue Oct 6, 2016
@WebDucer
Copy link
Author

WebDucer commented Oct 7, 2016

I found the reason.

Nexus3 have different behaviour, if you call the root nuget URL with or without ending "/" in the URL.

http://<your-nexus-domain>/repository/nuget-group/

Result Code: 200
http://<your-nexus-domain>/repository/nuget-group

Result Code: 404

ConfigFile.fs has a function checkCredentials that check the stored credentials in the configuration file. This check call the root repository url (without /). And this fails. This results in connection without credentials.

I issued this behaviour by sonatype.

@forki
Copy link
Member

forki commented Oct 7, 2016

If they can't fix it then we can just workaround by checking that url as
well?

2016-10-07 9:08 GMT+02:00 Eugen Richter [email protected]:

I found the reason.

Nexus3 have different behaviour, if you call the root nuget URL with or
without ending "/" in the URL.

http:///repository/nuget-group/

Result Code: 200

http:///repository/nuget-group

Result Code: 404

FonfigFile.fs has a function checkCredentials that check the stored
credentials in the configuration file. This check call the root repository
url (without /). And this fails. This results in connection without
credentials.

I issued this behaviour by sonatype.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#1941 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AADgNEJc2UcTi3btxlPD45JwclXQAEegks5qxe_WgaJpZM4KPrGB
.

@forki forki closed this as completed in c51b1ef Oct 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants