ironmansoftware / powershell-universal

Issue tracker for PowerShell Universal
https://powershelluniversal.com
35 stars 3 forks source link

Endpoints not working after upgrade from 3.10.2 to 4.2.17 #3292

Open RubenT91 opened 5 months ago

RubenT91 commented 5 months ago

Version

4.2.17

Severity

Low

Environment

msi

Steps to Reproduce

Upgrade from .NET 6 and PowerShell 7.2 to .NET 8 and PowerShell 7.4.1 in a test environment with two servers and a MS SQL backend. Remove the existing .NET 6 hosting bundle and PowerShell 7.2 installation. Install the latest .NET 8 Hosting bundle and PowerShell 7.4.1. Rename the existing "PowerShell 7.2" environment to "PowerShell 7" and update the references in the scripts.ps1 and endpoints.ps1 files accordingly. Restart the server after the changes. Attempt to call any API endpoint, e.g., /api/windows/GetInfo with a POST method and server names in the JSON body.

Expected behavior

After the upgrade, all API endpoints should work as expected, allowing successful execution and retrieval of data without any errors.

Actual behavior

When calling any API endpoint, a 500 error is encountered, and no logic is executed.
The tags for API endpoints do not populate correctly in the properties.
Attempting to modify any API in the GUI results in an error.
The API Documentation (Swagger UI) page only shows endpoints without configured roles, and even those endpoints do not work.
A trigger configured to launch on the 500 error provides the following information:
{
  "Message": {
    "StatusCode": 500,
    "Body": "API environment is not running! Please ensure your environment is configured correctly.",
    "Cookies": [],
    "Data": [],
    "ContentType": "text/plain",
    "Headers": [],
    "File": null
  },
  "Method": "POST",
  "RemoteIpAddress": "***.***.**.**",
  "Url": "/api/ad/GetServers",
  "RequestBody": "{\\r\\n    \\"Domains\\":  \\"***PII***.tst\\"\\r\\n}",
  "StatusCode": {
    "StatusCode": 500,
    "Body": "API environment is not running! Please ensure your environment is configured correctly.",
    "Cookies": [],
    "Data": [],
    "ContentType": "text/plain",
    "Headers": [],
    "File": null
  },
  "Identity": "**PII***\\\\***PII***"
}

Additional Environment data

System logs are attached, specifically downloaded from the /api/windows/GetInfo endpoint. PowerShell Universal version is 4.2.17, migrated from 3.10.2 (production version of 3.10.2 works fine). The APIs use different branches of a Git repo, but they were merged before the upgrade. Restarting the endpoints in the GUI, recycling the app pool, and restarting the entire server did not resolve the issue.

Screenshots/Animations

Screenshots and logs attached to ticket.

jesse-c1b commented 1 month ago

I'm still seeing this issue on 4.3.4. It only appears to affect endpoints. The same repository works fine on version 3. This issue is keeping us from being able to upgrade to version 4. Please let me know if there is any additional logs or testing I can provide to help with this.