GlitchEnzo / NuGetForUnity

A NuGet Package Manager for Unity

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

405 error on private nuget source

ArnavS59 opened this issue · comments

Description

[Describe the issue you have. If applicable provide logs produced by enabeling verbose logging in the NuGetForUnity settings.]

  • NuGet Package: [What is the name and version of the NuGet package you are installing?] private nuget package
  • NuGetForUnity Version: [What version of NuGetForUnity are you running?] 3.1.3
  • Unity Version: [What version of Unity are you using?] 2021.3.11f1
  • Operating System: [What OS are you on?] Windows

Hi all,

I am trying to add a private feed nuget source(jfrog artificatory) to the unity project. Upon adding the source via the GUI, I am getting a 405 error.

Unable to retrieve package list from https://<url>/artifactory/api/nuget/v3/.................../index.jsonSearch()?$filter=IsLatestVersion&$orderby=DownloadCount desc&$skip=0&$top=15&searchTerm=''&targetFramework=''&includePrerelease=false
System.Net.WebException: The remote server returned an error: (405) .
  at System.Net.HttpWebRequest.GetResponseFromData (System.Net.WebResponseStream stream, System.Threading.CancellationToken cancellationToken) [0x00146] in <a971fed4bf844502b6501dbde9cced46>:0 
  at System.Net.HttpWebRequest.RunWithTimeoutWorker[T] (System.Threading.Tasks.Task`1[TResult] workerTask, System.Int32 timeout, System.Action abort, System.Func`1[TResult] aborted, System.Threading.CancellationTokenSource cts) [0x000f8] in <a971fed4bf844502b6501dbde9cced46>:0 
  at System.Net.HttpWebRequest.GetResponse () [0x00016] in <a971fed4bf844502b6501dbde9cced46>:0 
  at NugetForUnity.NugetHelper.RequestUrl (System.String url, System.String userName, System.String password, System.Nullable`1[T] timeOut) [0x000e4] in <e385a841b2ca4c5a8d8a0c01b87bfe31>:0 
  at NugetForUnity.NugetPackageSource.GetPackagesFromUrl (System.String url, System.String username, System.String password) [0x00033] in <e385a841b2ca4c5a8d8a0c01b87bfe31>:0 
  at NugetForUnity.NugetPackageSource.Search (System.String searchTerm, System.Boolean includeAllVersions, System.Boolean includePrerelease, System.Int32 numberToGet, System.Int32 numberToSkip) [0x000db] in <e385a841b2ca4c5a8d8a0c01b87bfe31>:0 
UnityEngine.Debug:LogErrorFormat (string,object[])
NugetForUnity.NugetPackageSource:Search (string,bool,bool,int,int)
NugetForUnity.NugetHelper:Search (string,bool,bool,int,int)
NugetForUnity.NugetWindow:UpdateOnlinePackages ()
NugetForUnity.NugetWindow:Refresh (bool)
NugetForUnity.NugetWindow:DrawMandatoryButtons ()
NugetForUnity.NugetWindow:DrawOnlineHeader ()
NugetForUnity.NugetWindow:DrawOnline ()
NugetForUnity.NugetWindow:OnGUI ()
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

The NuGet.config file looks like

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="Artifactory" value="https://<url>/artifactory/api/nuget/v3/............/index.json" />
    <add key="NuGet" value="http://www.nuget.org/api/v2/" />
  </packageSources>
  <disabledPackageSources />
  <packageSourceCredentials>
    <Artifactory>
      <add key="userName" value="" />
      <add key="clearTextPassword" value="" />
    </Artifactory>
  </packageSourceCredentials>
  <activePackageSource>
    <add key="All" value="(Aggregate source)" />
  </activePackageSource>
  <config>
    <add key="repositoryPath" value="./Packages" />
    <add key="DefaultPushSource" value="http://www.nuget.org/api/v2/" />
    <add key="ReadOnlyPackageFiles" value="false" />
  </config>
</configuration>

Does anyone know what the issue might be related to?

Hi @ArnavS59
Thanks for creating a issue. From your URL I can see that you are using a package source with API version 3. The currently released version of NuGetForUnity only supports API version 2. The current Beta version of NuGetForUnity has support for API version 3. You can install it using the git install method or using a .unitypackage build by the CI.

@ArnavS59 it would be nice to get feedback if it works, because I never tested against a NuGet source hosted on artifactory.

@JoC0de We tested against our artifacts hosted on Artifactory and V3 seems to be working well 😄

I just released version 4.0.0 witch contains fixes so that it now works for NuGet source hosted on Artifactory (see #579).
If you still have problems pleas create a new issue.