|## Problem:
I have a source repo on Articfactory that hosts my internal powershell modules but also serves as a proxy for the default PSGallery repository.
everything is fine with the first call, the dependencies get installed as expected. But the second time I get the following exception
VERBOSE: GET https://artifactory.mylocal.domain/artifactory/api/nuget/myrepo/Packages?$filter=Id eq 'InvokeBuild' and IsLatestVersion with 0-byte payload
Invoke-RestMethod : The remote server returned an error: (405) Method Not Allowed.
At C:\UserData\User\Documents\WindowsPowerShell\Modules\PSDepend\0.3.8\Private\Find-NugetPackage.ps1:47 char:5
+ Invoke-RestMethod $URI -Headers $headers |
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
VERBOSE: You have the latest version of [InvokeBuild], with installed version [5.7.1] and PSGallery version []
same error for dotenv. The same call works if I use the default PSGallery url as source.
Solution:
The query URI is created in Find-NugetPackages.ps1, e.g. like
$URI = "${PackageSourceUrl}Packages?`$filter=Id eq '$name' and IsLatestVersion
The problem with this is that Artifactory expects the search uri to be
$URI = "${PackageSourceUrl}Packages()?`$filter=Id eq '$name' and IsLatestVersion
mind the () behind Packages. AFAIK this is the define "standard" (if such a thing exists) but most of the nuget servers on the internet accept uris without the () as well. Not so artifactory.
Proposal
add () to the search URI creation. According to my tests this works with nuget.org and powershellgallery.com, so I assume that any other nuget server will bi accpting the braces, too. And Artifactory is also happy :-)
|## Problem: I have a source repo on Articfactory that hosts my internal powershell modules but also serves as a proxy for the default PSGallery repository.
Configuration example
When I run two times behind each other
everything is fine with the first call, the dependencies get installed as expected. But the second time I get the following exception
same error for
dotenv
. The same call works if I use the default PSGallery url as source.Solution:
The query URI is created in
Find-NugetPackages.ps1
, e.g. likeThe problem with this is that Artifactory expects the search uri to be
mind the
()
behindPackages
. AFAIK this is the define "standard" (if such a thing exists) but most of the nuget servers on the internet accept uris without the()
as well. Not so artifactory.Proposal
add
()
to the search URI creation. According to my tests this works withnuget.org
andpowershellgallery.com
, so I assume that any other nuget server will bi accpting the braces, too. And Artifactory is also happy :-)PR is on the way!