Get-UDElement not working after 4.2.1 update

Product: PowerShell Universal
Version: 4.2.1

I updated from 4.0.9 to 4.2.1 today, in response to the security notice Security Update: PowerShell Universal CVE TBD (ironmansoftware.com)

Unfortunately, this broke a lot of buttons for me. Most, but not all, buttons that use Get-UDElement to pull data from a table, no longer works.

Seems to be the same issue as in this post Get-UDelement stopped working on large tables - PowerShell Universal - Ironman Software Forums. It’s posted in the general PSU category, so I’m creating a separate post located in the sub category of PSU > UD.

I haven’t been able to work out why it works with pulling data from some tables but not from others.

New-UDTable -Id "table" -Data $tableData_Sorted -Columns $columns -Title "Azure VMs Owned by: $user" -ShowSelection -Dense -Size Small -ShowPagination -PageSize 5 -ShowSearch -ShowSort -ShowFilter

$button_Renewals = New-UDButton -Id "button_Renewals"-Text "Renewals" -Color Primary -OnClick {
    # Other code before this works.
    $values = Get-UDElement -Id "table"
    # Other code after this does not run.
}

When I click the Renewals button, code before Get-UDElement runs just fine, but all code after it is not run. I tried putting Show-UDToast directly after it and nothing.

Note…the exact code (copy/paste) in some other apps, that pull data using Get-UDElement -Id “table”, are working just fine.

When I restart the page, browse to the console window, and run Get-UDElement -Id “table”, I get no results. But I get this in the logs.

When I click the Renewals button, I get this in the logs.

Unfortunately, I’m in the middle of a project and cannot afford downtime from this. I’ve had to roll back to yesterday’s image backup, back to 4.0.9. I am not able to update to 4.2.x, for the security issue, until we have a fix or workaround for this.

Ideas?
Thanks,
Rob

1 Like

What other issues were you running into? We just patched with the same update and now none of our Apps want to start. Thinking of reverting back down to version 3 honestly.

From version 3 to 4 I had a couple of issues start up. Table data sorted backwards, and tables in a UDDynamic would no longer update their data during a Sync-UDElement action; unless I used a dynamic number in the table name. Such as setting $page:count = 0 at the top of an app, inside my UDDynamic set $page:count ++, and then name my table like -Id “table_$page:count”. Doing that fixed my dynamic tables.

For this specific update to 4.2.1, the only new issue I’ve found is the broken buttons when calling Get-UDElement -Id “table”. Broken when retrieving data from some tables, but not from others.

BR,
Rob

I just updated and I have the same problem so I had to revert back.

We’re looking into this. We changed how Get-UDElement works to use a WebSocket rather than HTTP request due to performance reasons but it seems like there is some sort of max value we need to increase. This was changed in 4.2.

That said, the security fix was also rolled out in 4.1.10 so you should be able to upgrade to that to avoid the bug and also apply the fix.

1 Like

Hey @adam, thanks for the info and good to know you’re aware of and working on it.

I did not see version 4.1.10 on the page linked to in the article, but now I see that if I scroll down to Previous Versions and click View, it takes me to where I can download 4.1.10.

I upgraded but ran into problems immediately. 3 of my apps were missing, and when I re-created one of them all 3 disappeared from the script. Not a big deal, can re-create them, but the big one is 4.1.10 has the Azure connection bug. I cannot connect to Azure on 4.1.10. This breaks important apps, and my current project is building an Azure VM self-service app. So now I’m having to image rollback to 4.0.9 again.

I can’t upgrade to 4.2.1, because it breaks the ability to pull data from large tables. I can’t upgrade to 4.1.10, because of the Azure connection bug. I guess I’m stuck having to do the work around and remove all param blocks from my endpoints. I look forward to a 4.2.x upgrade that contains the fix for getting data from large tables.

BR,
Rob

Or use [PSTypeName]
PSTypeNameAttribute Class (System.Management.Automation) | Microsoft Learn

AND validate that what you got as input is what you want, before running the endpoint scriptblock

Thanks @alongvili , that look slick. However, from my limited understanding (10 min of research) I’d need to set a custom PSTypeName on the parameters in the endpoint functions. Then all calls to them would have to create a PSCustomObject with the matching custom PSTypeName as one of its properties, and submit that instead of a string to the endpoint. If the custom PSTypeName matches, it’s valid; if not, it’s not.

If I’m correct, then PoSh scripts calling them would all need to be updated, dozens. Also, we have future plans to expand internal integrations outside of systems running PoSh, using endpoints.

I’ll keep the PSTypeName thing in mind for future development, but for now I just commented out all the param blocks in my endpoints and successfully tested them. Once a 4.2.x version is out that fixes Get-UDElement for large tables I’ll uncomment the param blocks.

Thanks,
Rob

Thanks again @AlonGvili!

I upgraded to 4.2.2 today and everything is good to go. I uncommented my endpoint param blocks, Azure connects just fine, and Get-UDElement is working with all tables :slight_smile:

Have a good one!
Rob