Pode.Web icon indicating copy to clipboard operation
Pode.Web copied to clipboard

After migrating to preview Pode.Web 1.0.0: 'Get-PodeWebState' is not recognized

Open NicolasTNS opened this issue 1 year ago • 2 comments

After migrating to preview Pode.Web 1.0.0: 'Get-PodeWebState' is not recognized

CaptureErreurPodeWeb1

'Get-PodeWebState' is not included in module commands.

CaptureErreurPodeWeb2

'Get-PodeWebState' is present in many ps1.

CaptureErreurPodeWeb3

Thanks!

NicolasTNS avatar Jun 14 '24 08:06 NicolasTNS

Hi @NicolasTNS,

I think I might have worked out why this happens, as I also just triggered the same error. It will require a fix in core Pode though.

To see if the cause is the same, do you happen to use Export-PodeModule or ConvertTo-PodeWebPage at all?

Badgerati avatar Jul 01 '24 20:07 Badgerati

Hi,

I get the same message. I am not usingExport-PodeModuleor ConvertTo-PodeWebPage.

Pode.Web 1.0.0 preview2 Pode 2.10.1

datenschieber avatar Jul 06 '24 10:07 datenschieber

Hello, same issue here. It worked okay on Pode 2.11.0, then I updated to 2.11.1 and it broke, so I reverted to 2.11.0 and it's still not working, so I'm at a bit of a loss. Routes work fine, the pages just produce that sam Get-PodeWebState command not found.

diflartle avatar Nov 19 '24 13:11 diflartle

Hi @NicolasTNS, @datenschieber, @diflartle,

I've just reproduced this myself, and it's caused by having AutoImport disabled in your server.psd1 file:

@{
    Server = @{
        AutoImport = @{
            Modules = @{
                Enable = $false
            }
        }
    }
}

You can either set Enable = $true or remove the AutoImport section, or if you need is "disabled" then setting it to true but also setting ExportOnly to true wil mimic it being disabled, but will allow Pode.Web to load:

@{
    Server = @{
        AutoImport = @{
            Modules = @{
                Enable     = $true
                ExportOnly = $true
            }
        }
    }
}

This has worked for myself, and people on Discord, so let me know if it does/doesn't work for yourselves. I can look to update the migration guide to reference this configuration.

Badgerati avatar Dec 05 '24 21:12 Badgerati