OneGet / oneget

PackageManagement (aka OneGet) is a package manager for Windows
MIT License
2.38k stars 190 forks source link

Unable to install module hosted on a private baget server nuget feed (v3) #430

Open alerickson opened 5 years ago

alerickson commented 5 years ago

issue opened by @junkiebev see: https://github.com/PowerShell/PowerShellGet/issues/412

PowerShellGet version:

get-module PowerShellGet

ModuleType Version    Name                                ExportedCommands                                                                                                 
---------- -------    ----                                ----------------                                                                                                 
Script     2.0.4      PowerShellGet                       {Find-Command, Find-DscResource, Find-Module, Find-RoleCapability...} 

Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.1.17134.407
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17134.407
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
> Get-Module -ListAvailable PowerShellGet,PackageManagement
ModuleType Version    Name                                ExportedCommands                                                                                                 
---------- -------    ----                                ----------------                                                                                                 
Script     1.2.4      PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}                                           
Binary     1.0.0.1    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}                                           
Script     2.0.4      PowerShellGet                       {Find-Command, Find-DSCResource, Find-Module, Find-RoleCapability...} 
> Get-PackageProvider -ListAvailable
Name                     Version          DynamicOptions                                                                                                                   
----                     -------          --------------                                                                                                                   
msi                      3.0.0.0          AdditionalArguments                                                                                                              
msu                      3.0.0.0                                                                                                                                           
nuget                    2.8.5.208                                                                                                                                         
NuGet                    3.0.0.1          Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag, Contains, AllowPrereleaseVersions, ConfigFile, Ski...
PowerShellGet            2.0.4.0          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, InstallUpdate, NoPathUpdate, AllowPrereleaseVersions...
Programs                 3.0.0.0          IncludeWindowsInstaller, IncludeSystemComponent 

Describe the bug

I'm unable to install from (though I am able to publish to) PowerShell modules using the Install-Module PowerShell commandlet in PowerShellGet, which is the recommended way to install PowerShell modules from a NuGet feed.

To Reproduce

Steps to reproduce the behavior:

  1. Using this version of BaGet: 'Hand build into a docker image, using the master branch of the repo on 1/30/2019"
  2. Run this code 'sudo docker run --rm --name baget-server -p 5555:80 --env-file baget.env -v "$(pwd)/baget-data:/var/baget" junkiebev/baget:v1.0.0' - the baget.env file contains the content currently documented on the website
  3. Reproduce error
    • Download and extract to a directory a powershell module from the PowerShell gallery and extract it. In this case, I used Write-ObjecToSQL version 1.13.
    • Register a PowerShell Repository
      
      $repo = @{
      Name = 'baget'
      SourceLocation = "http://chd9fmks1dt.COMPANY.com:5555/v3/index.json"
      PublishLocation = "http://chd9fmks1dt.COMPANY.com:5555/v3/index.json"
      InstallationPolicy = 'Trusted'
      }
      Register-PSRepository @repo
---------------------------
<br/>

- Publish the package:
`Publish-Module -Path .\Write-ObjectToSQL -Repository baget -NuGetApiKey "NUGET-SERVER-API-KEY"`
- The package shows up in the website UI
- The package shows up if you query all of the packages in that repo

Find-Module -Repository baget | select *

Name : Write-ObjectToSQL Version : 1.13.0 Type : Module Description : Writes the properties of an object into a database table. The table will be created if it doesnt exist. Author : John Roos CompanyName : Copyright : PublishedDate : InstalledDate : UpdatedDate : LicenseUri : ProjectUri : https://github.com/JohnRoos/PowerShell/tree/master/Modules/Write-ObjectToSQL IconUri : Tags : {Database,, SQLServer,, Object,, PSModule,} Includes : {Function, RoleCapability, Command, DscResource...} PowerShellGetFormatVersion : ReleaseNotes : Dependencies : {} RepositorySourceLocation : baget Repository : baget PackageManagementProvider : NuGet AdditionalMetadata : @{summary=Writes the properties of an object into a database table. The table will be created if it doesnt exist.; isLatestVersion=False; developmentDependency=False; downloadCount=0; description=Writes the properties of an object into a database table. The table will be created if it doesnt exist.; PackageManagementProvider=NuGet; tags=Database, SQLServer, Object, PSModule, PSIncludes_Cmdlet, PSCmdlet_Write-ObjectToSQL, PSIncludes_Function, PSFunction_Write-ObjectToSQL, PSCommand_Write-ObjectToSQL; isAbsoluteLatestVersion=False; SourceName=baget; requireLicenseAcceptance=False; IsPrerelease=False}

- Searching for the specific module results in this error

Find-Module -Repository baget -name "Write-ObjectToSQL" -Debug DEBUG: 00:00:00.0000002 Calling New() : MethodName = 'ResolvePackageSources' DEBUG: 00:00:00.0000183 Verbose: False DEBUG: 00:00:00.0000292 Name: baget DEBUG: 00:00:00.0000393 ErrorVariable: ev DEBUG: 00:00:00.0007650 INVOKING PowerShell Fn Resolve-PackageSource with args that has length 0 DEBUG: 00:00:00.0014202 In PowerShellGet Provider - 'Resolve-PackageSource'. DEBUG: 00:00:00.0027318 Yielding package source for baget at location http://chd9fmks1dt.COMPANY.com:5555/v3/index.json DEBUG: 00:00:00.0035762 Done calling powershell «Resolve-PackageSource» «PSModule» DEBUG: 00:00:00.0066347 Calling New() : MethodName = 'GetDynamicOptions' DEBUG: 00:00:00.0066552 Verbose: False DEBUG: 00:00:00.0066694 Name: baget DEBUG: 00:00:00.0066833 ErrorVariable: ev DEBUG: 00:00:00.0073400 INVOKING PowerShell Fn Get-DynamicOptions with args Provider that has length 1 DEBUG: 00:00:00.0080542 In PowerShellGet Provider - 'Get-DynamicOptions'. DEBUG: 00:00:00.0090752 Done calling powershell «Get-DynamicOptions» «PSModule» DEBUG: 00:00:00.0145703 Calling New() : MethodName = 'GetDynamicOptions' DEBUG: 00:00:00.0145883 Verbose: False DEBUG: 00:00:00.0145992 Name: baget DEBUG: 00:00:00.0146101 ErrorVariable: ev DEBUG: 00:00:00.0152726 INVOKING PowerShell Fn Get-DynamicOptions with args Source that has length 1 DEBUG: 00:00:00.0158758 In PowerShellGet Provider - 'Get-DynamicOptions'. DEBUG: 00:00:00.0174636 Done calling powershell «Get-DynamicOptions» «PSModule» DEBUG: 00:00:02.3101001 Calling New() : MethodName = 'ResolvePackageSources' DEBUG: 00:00:02.3114422 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString DEBUG: 00:00:02.3126685 ProviderName: PowerShellGet DEBUG: 00:00:02.3198120 Verbose: False DEBUG: 00:00:02.3210457 Name: baget DEBUG: 00:00:02.3220960 ErrorVariable: ev DEBUG: 00:00:02.3235037 INVOKING PowerShell Fn Resolve-PackageSource with args that has length 0 DEBUG: 00:00:02.3251107 In PowerShellGet Provider - 'Resolve-PackageSource'. DEBUG: 00:00:02.3276147 Yielding package source for baget at location http://chd9fmks1dt.COMPANY.com:5555/v3/index.json DEBUG: 00:00:02.3289420 Done calling powershell «Resolve-PackageSource» «PSModule» DEBUG: 00:00:02.3356718 Calling New() : MethodName = 'ResolvePackageSources' DEBUG: 00:00:02.3367740 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString DEBUG: 00:00:02.3378105 ProviderName: PowerShellGet DEBUG: 00:00:02.3387118 Verbose: False DEBUG: 00:00:02.3393995 Name: baget DEBUG: 00:00:02.3405819 ErrorVariable: ev DEBUG: 00:00:02.3418323 INVOKING PowerShell Fn Resolve-PackageSource with args that has length 0 DEBUG: 00:00:02.3425986 In PowerShellGet Provider - 'Resolve-PackageSource'. DEBUG: 00:00:02.3442806 Yielding package source for baget at location http://chd9fmks1dt.COMPANY.com:5555/v3/index.json DEBUG: 00:00:02.3453762 Done calling powershell «Resolve-PackageSource» «PSModule» DEBUG: 00:00:00.0000001 Calling New() : MethodName = 'ResolvePackageSources' DEBUG: 00:00:00.0000237 Debug: True DEBUG: 00:00:00.0000381 Source: baget DEBUG: 00:00:00.0000508 Name: Write-ObjectToSQL DEBUG: 00:00:00.0008141 INVOKING PowerShell Fn Resolve-PackageSource with args that has length 0 DEBUG: 00:00:00.0015087 In PowerShellGet Provider - 'Resolve-PackageSource'. DEBUG: 00:00:00.0031133 Yielding package source for baget at location http://chd9fmks1dt.COMPANY.com:5555/v3/index.json DEBUG: 00:00:00.0039927 Done calling powershell «Resolve-PackageSource» «PSModule» DEBUG: 00:00:00.0070571 Calling New() : MethodName = 'GetDynamicOptions' DEBUG: 00:00:00.0070779 Debug: True DEBUG: 00:00:00.0070919 Source: baget DEBUG: 00:00:00.0071047 Name: Write-ObjectToSQL DEBUG: 00:00:00.0099547 INVOKING PowerShell Fn Get-DynamicOptions with args Provider that has length 1 DEBUG: 00:00:00.0107296 In PowerShellGet Provider - 'Get-DynamicOptions'. DEBUG: 00:00:00.0118169 Done calling powershell «Get-DynamicOptions» «PSModule» DEBUG: 00:00:00.0148330 Calling New() : MethodName = 'GetDynamicOptions' DEBUG: 00:00:00.0148528 Debug: True DEBUG: 00:00:00.0148665 Source: baget DEBUG: 00:00:00.0148793 Name: Write-ObjectToSQL DEBUG: 00:00:00.0155468 INVOKING PowerShell Fn Get-DynamicOptions with args Source that has length 1 DEBUG: 00:00:00.0162440 In PowerShellGet Provider - 'Get-DynamicOptions'. DEBUG: 00:00:00.0180098 Done calling powershell «Get-DynamicOptions» «PSModule» DEBUG: 00:00:00.0232328 Calling New() : MethodName = 'GetDynamicOptions' DEBUG: 00:00:00.0232557 Debug: True DEBUG: 00:00:00.0232694 Source: baget DEBUG: 00:00:00.0232821 Name: Write-ObjectToSQL DEBUG: 00:00:00.0240991 INVOKING PowerShell Fn Get-DynamicOptions with args Package that has length 1 DEBUG: 00:00:00.0248401 In PowerShellGet Provider - 'Get-DynamicOptions'. DEBUG: 00:00:00.0282863 Done calling powershell «Get-DynamicOptions» «PSModule» DEBUG: 00:00:00.7397806 Calling New() : MethodName = 'ResolvePackageSources' DEBUG: 00:00:00.7408836 ProviderName: PowerShellGet DEBUG: 00:00:00.7423086 Type: Module DEBUG: 00:00:00.7436397 Source: baget DEBUG: 00:00:00.7450176 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString DEBUG: 00:00:00.7480055 Debug: True DEBUG: 00:00:00.7486322 Name: Write-ObjectToSQL DEBUG: 00:00:00.7495547 INVOKING PowerShell Fn Resolve-PackageSource with args that has length 0 DEBUG: 00:00:00.7502774 In PowerShellGet Provider - 'Resolve-PackageSource'. VERBOSE: Repository details, Name = 'baget', Location = 'http://chd9fmks1dt.COMPANY.com:5555/v3/index.json'; IsTrusted = 'True'; IsRegistered = 'True'. DEBUG: 00:00:01.8641825 Yielding package source for baget at location http://chd9fmks1dt.COMPANY.com:5555/v3/index.json DEBUG: 00:00:01.8671617 Done calling powershell «Resolve-PackageSource» «PSModule» DEBUG: 00:00:01.8672944 Calling SearchForPackages. Name='Write-ObjectToSQL' VERBOSE: Using the provider 'PowerShellGet' for searching packages. DEBUG: 00:00:01.8690369 PackageProvider::FindPackage with name Write-ObjectToSQL DEBUG: 00:00:01.8696576 Calling SearchForPackages After Select 1 DEBUG: 00:00:01.8787970 Calling New() : MethodName = 'FindPackage' DEBUG: 00:00:01.8793519 ProviderName: PowerShellGet DEBUG: 00:00:01.8798899 Type: Module DEBUG: 00:00:01.8804651 Source: baget DEBUG: 00:00:01.8810067 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString DEBUG: 00:00:01.8815496 Debug: True DEBUG: 00:00:01.8820819 Name: Write-ObjectToSQL DEBUG: 00:00:01.8913914 INVOKING PowerShell Fn Find-Package with args System.String[], , , that has length 4 DEBUG: 00:00:01.8927613 In PowerShellGet Provider - 'Find-Package'. DEBUG: 00:00:01.8940210 OPTION: ProviderName => PowerShellGet DEBUG: 00:00:01.8955056 OPTION: Type => Module DEBUG: 00:00:01.8970041 OPTION: Source => baget DEBUG: 00:00:01.8993245 OPTION: MessageResolver => Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString DEBUG: 00:00:01.9001381 OPTION: Debug => True DEBUG: 00:00:01.9008272 OPTION: Name => Write-ObjectToSQL VERBOSE: Using the specified source names : 'baget'. VERBOSE: Getting the provider object for the PackageManagement Provider 'NuGet'. VERBOSE: The specified Location is 'http://chd9fmks1dt.COMPANY.com:5555/v3/index.json' and PackageManagementProvider is 'NuGet'. DEBUG: 00:00:01.9069217 PackageProvider::FindPackage with name Write-ObjectToSQL DEBUG: 00:00:01.9093828 Calling 'NuGet'::'FindPackage' - name='Write-ObjectToSQL', requiredVersion='',minimumVersion='', maximumVersion='''. DEBUG: 00:00:01.9106513 Iterating 'Write-ObjectToSQL'. DEBUG: 00:00:01.9117811 There are '7' registered sources in 'NuGet' provider. DEBUG: 00:00:01.9123819 Source 'http://chd9fmks1dt.COMPANY.com:5555/v3/index.json' is not one of the registered sources in 'NuGet' provider. DEBUG: 00:00:01.9129773 Source 'http://chd9fmks1dt.COMPANY.com:5555/v3/index.json' is validated. DEBUG: 00:00:01.9144181 Calling 'NuGetRequest'::'GetPackageById', 'Write-ObjectToSQL'. DEBUG: 00:00:01.9173521 Calling 'NuGetPackageRepository'::'FindPackagesById', 'Write-ObjectToSQL'. DEBUG: 00:00:01.9192746 Calling 'NuGetPackageFeed3'::'Find', 'Write-ObjectToSQL'. DEBUG: 00:00:01.9236241 Calling 'NuGetPackageFeed3'::'FindImpl', 'Write-ObjectToSQL'. DEBUG: 00:00:01.9250263 Returning the call 'NuGetPackageFeed3'::'FindImpl'. DEBUG: 00:00:01.9263363 Returning the call 'NuGetPackageFeed3'::'Find'. DEBUG: 00:00:01.9274801 Calling 'NuGetPackageFeed3'::'Find', 'http://chd9fmks1dt.COMPANY.com:5555/v3/registration/write-objecttosql/index.json'. DEBUG: 00:00:01.9283043 Downloading 'http://chd9fmks1dt.COMPANY.com:5555/v3/registration/write-objecttosql/index.json'. DEBUG: 00:00:02.0650665 Completed downloading 'http://chd9fmks1dt.COMPANY.com:5555/v3/registration/write-objecttosql/index.json'. WARNING: An internal error occurred: The JSON object returned by the NuGet API does not match expected schema. Expected property: 'type'. Check the debug stream for the ful l JSON object dump. DEBUG: 00:00:07.0706095 System.NullReferenceException: Object reference not set to an instance of an object. at System.Object.GetType() at Microsoft.PackageManagement.NuGetProvider.DynamicJsonParser.FlattenObject(Object o, String numericalPrefix, Int32 currentFlattenDepth, Int32& maxFlattenDepth) at Microsoft.PackageManagement.NuGetProvider.DynamicJsonParser.FlattenDynamic(Object obj, String numericalPrefix, Int32 currentFlattenDepth, Int32& maxFlattenDepth) at Microsoft.PackageManagement.NuGetProvider.DynamicJsonParser.FlattenObject(Object o, String numericalPrefix, Int32 currentFlattenDepth, Int32& maxFlattenDepth) at Microsoft.PackageManagement.NuGetProvider.DynamicJsonParser.FlattenDynamic(Object obj, String numericalPrefix, Int32 currentFlattenDepth, Int32& maxFlattenDepth) at Microsoft.PackageManagement.NuGetProvider.DynamicJsonParser.FlattenObject(Object o, String numericalPrefix, Int32 currentFlattenDepth, Int32& maxFlattenDepth) at Microsoft.PackageManagement.NuGetProvider.DynamicJsonParser.FlattenObject(Object o, String numericalPrefix, Int32 currentFlattenDepth, Int32& maxFlattenDepth) at Microsoft.PackageManagement.NuGetProvider.DynamicJsonParser.FlattenDynamic(Object obj, String numericalPrefix, Int32 currentFlattenDepth, Int32& maxFlattenDepth) at Microsoft.PackageManagement.NuGetProvider.DynamicJsonParser.FlattenObject(Object o, String numericalPrefix, Int32 currentFlattenDepth, Int32& maxFlattenDepth) at Microsoft.PackageManagement.NuGetProvider.DynamicJsonParser.FlattenObject(Object o, String numericalPrefix, Int32 currentFlattenDepth, Int32& maxFlattenDepth) at Microsoft.PackageManagement.NuGetProvider.DynamicJsonParser.FlattenDynamic(Object obj, String numericalPrefix, Int32 currentFlattenDepth, Int32& maxFlattenDepth) at Microsoft.PackageManagement.NuGetProvider.DynamicJsonParser.Serialize(Object obj, String numericalPrefix) at Microsoft.PackageManagement.NuGetProvider.NuGetPackageFeed3.Find(String registrationUrl, NuGetSearchContext context, RequestWrapper request, Boolean finalAttempt) at Microsoft.PackageManagement.NuGetProvider.NuGetPackageFeed3.d__6.MoveNext() at System.Linq.Enumerable.WhereEnumerableIterator1.MoveNext() at System.Linq.Enumerable.Any[TSource](IEnumerable1 source) at Microsoft.PackageManagement.NuGetProvider.NuGetRequest.GetPackageById(PackageSource source, String name, NuGetRequest request, String requiredVersion, String minimumV ersion, String maximumVersion, Boolean minInclusive, Boolean maxInclusive, Boolean isDependency) VERBOSE: Total package yield:'0' for the specified package 'Write-ObjectToSQL'. DEBUG: 00:00:07.0708165 Completed iterating for 'Write-ObjectToSQL'. DEBUG: 00:00:07.0710982 PowerShell Script 'PSModule' Function 'Find-Package' returns null. DEBUG: 00:00:07.0718265 Done calling powershell «Find-Package» «PSModule» DEBUG: 00:00:09.8244323 unmatched package name='Write-ObjectToSQL' PackageManagement\Find-Package : No match was found for the specified search criteria and package name 'Write-ObjectToSQL'. Try Get-PackageSource to see all available registered package sources. At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.0.4\PSModule.psm1:8665 char:9

Note that this could be several things

  1. Lack OF OData integration in baget
  2. PowerShellGet not being compatible with v3 NuGet Feeds (though it can publish which is weird and it shows up in a generalized query.
  3. baget not publishing the type property/not handling the publishing of PS Modules correctly.
  4. type, though expected, isn't generated by the v3 spec
  5. Operator Error - I've tried defining the PowerShell repository several different ways and it always throws the same, or similar errors of missing type property

Expected behavior

The module is published in the correct format and installs correctly from the baget NuGet Feed

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Is anyone using baget to serve PowerShell modules? Is there another Docker image which I should be using for this? If so, which would you recommend?

UI Screenshot

image

I've been bashing my head against this for two days, so thank you so much for any suggestions you might have.

alerickson commented 5 years ago

My /v3/index.json file looks like this

{
    "version": "3.0.0",
    "resources": [
        {
            "@id": "http://chd9fmks1dt.COMPANY.com:5555/api/v2/package",
            "@type": "PackagePublish/2.0.0",
            "comment": ""
        },
        {
            "@id": "http://chd9fmks1dt.COMPANY.com:5555/api/v2/symbol",
            "@type": "SymbolPackagePublish/4.9.0",
            "comment": ""
        },
        {
            "@id": "http://chd9fmks1dt.COMPANY.com:5555/v3/search",
            "@type": "SearchQueryService",
            "comment": ""
        },
        {
            "@id": "http://chd9fmks1dt.COMPANY.com:5555/v3/search",
            "@type": "SearchQueryService/3.0.0-beta",
            "comment": ""
        },
        {
            "@id": "http://chd9fmks1dt.COMPANY.com:5555/v3/search",
            "@type": "SearchQueryService/3.0.0-rc",
            "comment": ""
        },
        {
            "@id": "http://chd9fmks1dt.COMPANY.com:5555/v3/registration/",
            "@type": "RegistrationsBaseUrl",
            "comment": ""
        },
        {
            "@id": "http://chd9fmks1dt.COMPANY.com:5555/v3/registration/",
            "@type": "RegistrationsBaseUrl/3.0.0-rc",
            "comment": ""
        },
        {
            "@id": "http://chd9fmks1dt.COMPANY.com:5555/v3/registration/",
            "@type": "RegistrationsBaseUrl/3.0.0-beta",
            "comment": ""
        },
        {
            "@id": "http://chd9fmks1dt.COMPANY.com:5555/v3/package/",
            "@type": "PackageBaseAddress/3.0.0",
            "comment": ""
        },
        {
            "@id": "http://chd9fmks1dt.COMPANY.com:5555/v3/autocomplete",
            "@type": "SearchAutocompleteService",
            "comment": ""
        },
        {
            "@id": "http://chd9fmks1dt.COMPANY.com:5555/v3/autocomplete",
            "@type": "SearchAutocompleteService/3.0.0-rc",
            "comment": ""
        },
        {
            "@id": "http://chd9fmks1dt.COMPANY.com:5555/v3/autocomplete",
            "@type": "SearchAutocompleteService/3.0.0-beta",
            "comment": ""
        }
    ]
}
junkiebev commented 5 years ago

This may have something to do with a ‘-type all’ value not being provided to find-package on v3 feeds. It doesn’t have a default value.

loic-sharma commented 5 years ago

It looks like the bug is here as OneGet requires a @type property on registration resources (like this example). While NuGet.org provides a @type, this property isn't documented in the official registration documentation and does not need to be provided by server implementations. OneGet shouldn't fail if there is no @type property.

junkiebev commented 5 years ago

Does the repo just need to be registered with a different package provider than NuGet, even though the feed conforms to the NuGet spec and the Module Type is queryable? That'd be unfortunate...

loic-sharma commented 5 years ago

@junkiebev No, NuGet should be the correct package provider here. OneGet has a bug where it makes an incorrect assumption about the NuGet protocol.

@alerickson This should be fixed as the @type property is not an official part of the NuGet protocol. This property is present in nuget.org's responses due to an implementation detail of RDF, which is how we generate our JSON. This property may be removed in the future if we remove our dependency on RDF. Please let me know if you need any additional information/help :)

loic-sharma commented 4 years ago

I've mitigated this issue on BaGet by adding the @type property on its responses.

Nonetheless, this issue is now affecting GitHub Package Registry: https://twitter.com/adamdriscoll/status/1174558273875451904

junkiebev commented 4 years ago

Nonetheless, this issue is now affecting GitHub Package Registry: https://twitter.com/adamdriscoll/status/1174558273875451904

i'm Internet Famous!!

OCram85 commented 4 years ago

Hey guys, are there any news? - I think many people would be happy if this could be solved. Hosting a private NuGet feed with Baget seems to be the simplest solution for docker / dotnet.core environment.

loic-sharma commented 4 years ago

@OCram85 Are you still affected by this issue while using BaGet? This should be fixed on the latest Docker image.

OCram85 commented 4 years ago

@loic-sharma: Unfortunately I'm having the same issues. I tried the latest docker image yesterday with a PowerShell 5.1 and PowerShell 6 Client. Uploading packages works fine but finding and installing packages still throws the same error.

BaGet

devbeard commented 4 years ago

I encountered this bug today when trying to install a package from Github Packages. After some time rummaging the Debug output of OneGet, I found enough info to get here.

We had to implement a workaround using nuget.exe to get the module while we wait for this bug to be fixed. Doesn't help the non-Windows crowd unless they use Mono, but works in a pinch for us.

OneGet should not require fields that are not required in the NuGet spec. Sure, Github or BaGet or the next package manager down the line could of course add @type to their output, but it would be much more appropriate to fix the client (or fix the spec). Pretty please?

wightsci commented 4 years ago

Any news on this issue? We are running in to it here when trying to install from GitLab, which only supports v3 NuGet, but doesn't provide @type in the JSON output.

IlyaVassyutovich commented 3 years ago

Yeah, right now GitHub Packages is pretty useless for PoSh-modules. Spent hours to setup everything, even tweaked own fork of PowerShellGet (PowerShell/PowerShellGet#163) to be able to publish modules into GHP. Only to smash my sad face into @type-wall.

johnwc commented 3 years ago

We are also seeing this same error with our latest update to our jFrog Artifactory nuget repositories. Is there an ETA for this fix?

ghost commented 3 years ago

also seeing this with sonatype nexus. any plans for a fix for this issue?

or, are there any good workarounds that anyone's come up with?

ghost commented 3 years ago

for any who have this issue - a possible workaround is to just use the v2 nuget URL, if available. i don't know that this will work everywhere, but if your nuget v3 URL is http://nuget.server/repo/index.json, omit the index.json and give it a shot.

it's working for me on powershell 5.1 on server 2016 and powershell core 7 on macos using sonatype nexus.

jan-zaruba-deltatre commented 3 years ago

Still nothing? Still no way to use GitHun NuGet repo for PowerShell packages?

RossiDiGi commented 1 year ago

And we are in 2023 and still have this problem with PowerShell. Here is my case: I have problems getting information with Powershell Find-Package on a NuGet-Feed hosted on a local ProGet server. My Feed named "Common_Develop" ha a connector to https://api.nuget.org/v3/index.json. When I send Find-Packageto nuget.org directly everything works fine. As soon as I send the same request to the local ProGet feed that has a connector to nuget.org I get errors, because something with the JSON object schema is not as expected. Changing the the source URI to use ODATA (v2) instead of JSON-LD (v3) fixes the problem (as already reported above https://github.com/OneGet/oneget/issues/430#issuecomment-858432615 ). But the first try with Find-Packageagainst nuget.org uses JSON-LD (v3) and works fine. For error and workaround reproduction my powershell:


PS C:\Users\digiov> $PsVersionTable

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

PS C:\Users\digiov> Find-Package -Name System.IO -Source https://api.nuget.org/v3/index.json

Name                           Version          Source                           Summary
----                           -------          ------                           -------
System.IO                      4.3.0            https://api.nuget.org/v3/index.… Provides base input and output (I/O) types, including System.IO.Stream, System.IO.StreamReader and Sys…

PS C:\Users\digiov> Find-Package -Name System.IO -Source https://ProGet/nuget/Common_Develop/v3/index.json
WARNING: An internal error occurred: The JSON object returned by the NuGet API does not match expected schema. Expected property: 'type'. Check the debug stream for the full JSON object dump.       
Find-Package: No match was found for the specified search criteria and package name 'System.IO'. Try Get-PackageSource to see all available registered package sources.
PS C:\Users\digiov> Find-Package -Name System.IO -Source https://ProGet/nuget/Common_Develop/

Name                           Version          Source                           Summary
----                           -------          ------                           -------
System.IO                      4.3.0            https://ProGet/nuget/Common_De.… Provides base input and output (I/O) types, including System.IO.Stream, System.IO.StreamReader and Sys…
´´´
rickandersen-forte commented 12 months ago

I can't believe this is still a problem after almost four years. This project (OneGet) is hosted on GitHub, and yet it doesn't support GitHub as a PSRepository? Is there any word on when, or if, this will ever be fixed? Am I misunderstanding something, because it seems hard to believe that this can't somehow work. I've seen postings showing how to host a PS repo on GitHub. Did it used to work and broke at some point, or are they doing something different that allows it to work?

I have a client that hosts everything in a private GitHub organization and can't use public repositories, such as the PSGallery, so this is the only realistic place they can host a repository of PowerShell modules, but they can't because it doesn't work. Is there some kind of workaround since, seeing as this issue is almost four years old, it doesn't appear it will ever be fixed.

(Sorry if I sound upset. No offense intended. It's just that I've spent several days trying to figure out what I'm doing wrong before I found this issue and realized it simply doesn't work.)

ThomasNieto commented 12 months ago

@rickandersen-forte this project has been depredated in favor of PSResourceGet module. That module supports GitHub packages.