Error calling module from New-PSUEndpoint

Product: PowerShell Universal
Version: 2.12.2

I am running into a weird issue where I am trying to call a custom module via an API/endpoint and its not really working. I have validated that the endpoint is loading the module as im able to see it via get-module but im not able to call any of the cmdlets in the module.

New-PSUEndpoint -Url "/error"  -Method "GET" -Endpoint {
    #requires -modules MyModule
    Connect-PSUServer -ComputerName $Hostname -AppToken $AdminAppToken
    Get-hello
}

Module

function Get-hello {
    return "Hello world"
}

image

FYI: It seems to work on 3.0.1…

Any ideas?

Can you set the endpoint’s ErrorAction to Stop or Continue so it returns an error messages that might be happening?

Ill be honest here but it just started working on its own and I’m still not sure why. The only thing I’ve changed/done since posting this was rebooted the server.

The weird thing is that it was loading the module fine before when I was seeing this error. I’m clueless what “fixed” it.

Computers are mysterious.

1 Like