PowerShell / PowerShellGallery

219 stars 59 forks source link

I cannot publish a module that contains more than 5000 cmdlets in the PSGallery #246

Closed kamennikolov closed 1 year ago

kamennikolov commented 1 year ago

Prerequisites

Steps to reproduce

We have an existing module (VMware.Sdk.Nsx.Policy) that recently went above 5000 cmdlets. We have all the cmdlets listed in the CmdletsToExport section in the psd1 file in order for the auto-import feature to work properly. However we are unable to publish this module in the PowerShell gallery. The error message we're getting is: Publish-PSResource: Repository 'PSGallery': Response status code does not indicate success: 500 (You module metadata exceeds allowed size of 5000 nodes.).

Expected behavior

Module should be published successfully

Actual behavior

Publish-PSResource: Repository 'PSGallery': Response status code does not indicate success: 500 (You module metadata exceeds allowed size of 5000 nodes.)

Error details

Exception             :
    Type    : System.ArgumentException
    Message : Repository 'PSGallery': Response status code does not indicate success: 500 (You module
 metadata exceeds allowed size of 5000 nodes.).
    HResult : -2147024809
CategoryInfo          : PermissionDenied: (:) [Publish-PSResource], ArgumentException
FullyQualifiedErrorId : HTTPRequestError,Microsoft.PowerShell.PowerShellGet.Cmdlets.PublishPSResource
InvocationInfo        :
    MyCommand        : Publish-PSResource
    ScriptLineNumber : 1
    OffsetInLine     : 1
    HistoryId        : 4
    Line             : Publish-PSResource -Path "C:\Users\knikolov\OneDrive - VMware, Inc\VMwareCorp\Documen
ts\PowerShell\Modules\KamenModule" -ApiKey <apikey> -Repository PSGallery
    PositionMessage  : At line:1 char:1
                       + Publish-PSResource -Path "C:\Users\knikolov\OneDrive - VMware, Inc\VM …
                       + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    InvocationName   : Publish-PSResource
    CommandOrigin    : Internal
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo :

Environment data

PS C:\Users\knikolov> Get-Module PowerShellGet

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Binary     3.0.17     beta17     PowerShellGet                       {Find-PSResource, Get-PSResource, Get-PSResourceR…

PS C:\Users\knikolov> $PSVersionTable

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

Visuals

No response

anamnavi commented 1 year ago

@kamennikolov thanks for bringing this to our attention, we'll investigate this and get back to you by later this week.

kamennikolov commented 1 year ago

@anamnavi is there any update on this?

anamnavi commented 1 year ago

@kamennikolov sorry for the late response, we are still investigating into this and will have a response by end of the week. Are you trying to publish a new version of this package (that has 5000+ cmdlets)?

kamennikolov commented 1 year ago

Yes. The current version of the module has a little over 4000 cmdlets and the new one that I'm trying to upload has more than 5000.

anamnavi commented 1 year ago

@kamennikolov thanks for verifying, we'll have a fix out for this after the holidays. We have a deployment freeze until after the holidays, thanks for your patience with this!

kamennikolov commented 1 year ago

Thank you. I'll be expecting the fix after the holidays. Let me know when it's ready, so that I can test an verify it.

SteveL-MSFT commented 1 year ago

@kamennikolov we've had some discussion about this and wondering if you can explain why there are so many cmdlets within a single module? it would seem that there could be a practical user experience problem having so many individual cmdlets? We can certainly raise the limit, but want to make sure that would be the right decision.

kamennikolov commented 1 year ago

The module is automatically generated out of a REST API spec and generates one cmdlet per API operation. Furthermore, it also auto-generates cmdlets to help users build the complex input types. And since the API is quite big the total number of cmdlets is more than 5000. To ensure cmdlet discoverability we have a dedicated cmdlet that takes the REST API path and HTTP method as input and returns the cmdlet that corresponds to this API operation.

SteveL-MSFT commented 1 year ago

@kamennikolov appreciate the details, we also had guessed the cmdlets were being generated from REST APIs. For now, we're going to look into raising the limits to unblock you. However, we also recommend considering breaking up this module into multiple dependent modules and keeping the name of this one as a meta-module for ease of install if you intend to continue to grow the number of cmdlets.

anamnavi commented 1 year ago

@kamennikolov We're currently verifying the fix for this and will have it out soon

kamennikolov commented 1 year ago

Great. Thank you.

kamennikolov commented 1 year ago

Hi @anamnavi is there any update on this issue?

anamnavi commented 1 year ago

@kamennikolov Sorry for the delay, this fix is now live, thanks for the patience :)