PowerShell / PSResourceGet

PSResourceGet is the package manager for PowerShell
https://www.powershellgallery.com/packages/Microsoft.PowerShell.PSResourceGet
MIT License
492 stars 94 forks source link

Artifactory with v3 endpoint failing #1424

Closed alerickson closed 1 year ago

alerickson commented 1 year ago

Prerequisites

Steps to reproduce

Register-PSResourceRepository -name test2 -Uri "https://<>.jfrog.io/artifactory/api/nuget/v3/nuget/index.json"

Find-PSResource "test_module" -Repository test2 -Verbose -Debug

Expected behavior

Error with unauthorized credentials.

Actual behavior

Find-PSResource: '<' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0.

Error details

Exception             :
    Type       : System.Text.Json.JsonReaderException
    Message    : '<' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0.
    TargetSite :
        Name          : ThrowJsonReaderException
        DeclaringType : System.Text.Json.ThrowHelper, System.Text.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
        MemberType    : Method
        Module        : System.Text.Json.dll
    Source     : System.Text.Json
    HResult    : -2146233088
    StackTrace :
   at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan`1 bytes)
   at System.Text.Json.Utf8JsonReader.ConsumeValue(Byte marker)
   at System.Text.Json.Utf8JsonReader.ReadFirstToken(Byte first)
   at System.Text.Json.Utf8JsonReader.ReadSingleSegment()
   at System.Text.Json.Utf8JsonReader.Read()
   at System.Text.Json.JsonDocument.Parse(ReadOnlySpan`1 utf8JsonSpan, JsonReaderOptions readerOptions, MetadataDb& database, StackRowStack& stack)
   at System.Text.Json.JsonDocument.Parse(ReadOnlyMemory`1 utf8Json, JsonReaderOptions readerOptions, Byte[] extraRentedArrayPoolBytes, PooledByteBufferWriter extraPooledByteBufferWriter)
   at System.Text.Json.JsonDocument.Parse(ReadOnlyMemory`1 json, JsonDocumentOptions options)
   at System.Text.Json.JsonDocument.Parse(String json, JsonDocumentOptions options)
   at Microsoft.PowerShell.PSResourceGet.Cmdlets.V3ServerAPICalls.GetJsonElementArr(String request, String propertyName, Int32& totalHits, ErrorRecord& errRecord)
TargetObject          : Microsoft.PowerShell.PSResourceGet.Cmdlets.V3ServerAPICalls
CategoryInfo          : InvalidResult: (Microsoft.PowerShel…ts.V3ServerAPICalls:V3ServerAPICalls) [Find-PSResource], JsonReaderException
FullyQualifiedErrorId : GetResponsesFromRegistrationsResourceFailure,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource
InvocationInfo        :
    MyCommand        : Find-PSResource
    ScriptLineNumber : 1
    OffsetInLine     : 1
    HistoryId        : 16
    Line             : Find-PSResource "test_module" -Repository test2 -Verbose -Debug
    PositionMessage  : At line:1 char:1
                       + Find-PSResource "test_module" -Repository test2 -Verbose -Debug
                       + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    InvocationName   : Find-PSResource
    CommandOrigin    : Internal
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo :

Environment data


ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Binary     0.9.0      rc1        Microsoft.PowerShell.PSResourceGet  {Find-PSResource, Get-InstalledPSResource, Get-PSReso…

Name                           Value
----                           -----
PSVersion                      7.3.7
PSEdition                      Core
GitCommitId                    7.3.7
OS                             Microsoft Windows 10.0.22621
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

image

alerickson commented 1 year ago

Note: I think the issue here is that the feed does not exist, but this is not the correct error output