Error returned by endpoint


I configured PSU with some endpoint on several machines and all seems fine except one. I got “Error returned by endpoint” no matter what script I use. It returns error even for simple “test” string. I tried both service account and system for the service both produce the same error. If you have any ideas how to fix or what to check please help!


I doubt anyone will be able to help with the little info you provided. Can you share the endpoint’s configuration, or a screenshot of the error, or anything that can show us what you’re doing?

It seems the problem occurs after I set the environment to 5.1 on the endpoint. I do it because I use a module working with 5.1 only. Setting up 5.1 and the module worked on similar machines.

When I set up 5.1 it somehow kills the whole API section, and I need to restart the service. Then it work only until I run the endpoint configured with 5.1. With default it seems to work, but then the module doesn’t work.

as jesse said you need to post your code in order to identify your issue.

1 Like

For now I only used “test” in the code. Normally it returns “test”. but with 5.1 I got the errors I mentioned.

Not anything like Write-Output "test" or something like that? You literally just have the word "test" by itself?

Yes, only for testing, it works on other machines. (First I tried a script which worked on other machines, but I wanted to rule out any issues coming from there)

Okay. And, just to be clear, you’re saying that your endpoint with just the word "test" is causing that error when you call the endpoint from a specific workstation?

No, it seems to me the issue occurs when I set the environment to 5.1. (to use a module which requires it), but that worked already on several machines. I only realized this after I made the first post here and tried to vary the setting on the endpoint. With default it returns correctly ‘test’. But when I set up 5.1 and run the code, the issue occurs and only a service restart helps (until next run). I’ve already tried reinstall but issue remains.

I see. So, you changed the endpoint to be "test" as a way to see if the issue was with the environment or your script, and see that the issue remains (as in the issue is with the environment).

With a test endpoint set to run in Windows PowerShell 5.1, with just the word “test” in the code, I don’t get any errors. If you look at the endpoints.ps1 file under Settings/Configurations/Repository/.universal can you copy/paste the code for your specific endpoint so we can make sure there’s nothing different?

Mine is currently configured as:

New-PSUEndpoint -Url "/testing" -Method @('GET') -Endpoint {
} -Environment "Windows PowerShell 5.1"

Also, what version of PowerShell Universal are you running?

New-PSUEndpoint -Url “/testpsu” -Method @(‘GET’) -Endpoint {

This way it works.

New-PSUEndpoint -Url “/testpsu” -Method @(‘GET’) -Endpoint {
} -Environment “Windows PowerShell 5.1”

And this way it doesn’t. First I get “Error returned by endpoint”, then after some saves and runs, the error message for the whole endpoint section.

Version is: 4.2.14

Are you able to upgrade to the current release to see if the issue persists?

Sure, I try it.

Amazing, after the upgrade it works corretly! :slight_smile:
Thanks for the tip!

1 Like

Nice. Glad it fixed the issue. I don’t see any bugs in the release notes along the way that looked like they would be related but I’m guessing something was.

Btw. I still had to reinstall the latest version (on top of the upgrade), it still produced some strange errors, but since then it looks totally fine.

1 Like