Issues with modules on 4.0.2

Product: PowerShell Universal
Version: 4.0.2 ubuntu [docker]

Oh man, I had everything running smoothly earlier today and now I’m getting all manor of errors and problems.

I changed my setup a little while back, using a file share instead of sql and git, seemed more performant, less memory usage, less cost.

Long story short, I messed up with git (which I have setup on the repository folder with a gitignore and use to push manually from time to time), ended up accidently deleting half my modules folder located @ /Data/Repository/Modules - I think I lost some of the powershell universal module’s I installed from the GUI - PSHTML, icon packs/feather/bootstrap, joyride etc

I figured it wasn’t much of an issue, so just restored that folder from my backup choosing the overwrite option.

When I restarted my app, and went into the modules menu I got this, trying to select ‘powershell universal modules’ :

Anyway, I thought it was a bit odd, so figured, hey I’ll just delete them from the file system and restart my app then reinstall them. Yeah that didn’t go so well either, I ended up getting all manor of problems with my existing dashboards + the above.

Okay plan B… full backup, I stopped the web app, emptied the entire share of files, then ran a full restore from the previous night. even restored my web app not that it should matter.

Started up again and I’m getting errors in the GUI and in the logs, tons of them. For example:


Obviously thats refering to my usage of new-udhtml -markup, but my code hasnt changed and this is out of the box functionality so not related to custom modules.

Right… Plan C. Dump the DB file and let everything load in from my ps1 or env vars, I think everything is configured that way apart from my local admin account which I’ll just need to reset, all my secrets etc use azure keyvault anyway.

It looks like it’s back up and running… but, huh, same error as the screen shot I posted first in this thread. I’m scratching my head now thinking, maybe that’s a 4.0.2 bug, I cant be sure because I have just been fiddling with all sorts but thinking about it I did only just update and I haven’t been in the modules menu since…

I rolled back my docker image to 4.0.1 and woopie I’m back up and running with no issues on the modules front in the GUI, no other errors either.

I guess I cant be 100% sure that its a 4.0.2 bug, without upgrading back to 4.0.2, but I’m hesitant to at the moment, just wondered if anyone else experienced the same or similar issue?

I feel like it’s something potentially with what I’m doing. I’m also getting the following error on 4.0.1 after a similar problem. I installed Microsoft.Graph and it pulled all the sub modules which I didn’t want - trying to go into the GUI to remove that way and the web app wouldn’t load, it got stuck on the loading modules section even after a reboot. I manually deleted them instead, restarted the web app and I’m back to this issue again:

Cannot create object of type "PowerShellUniversal.DashboardPage". The property 'markup' was not found for the 'PowerShellUniversal.DashboardPage' object. The settable properties are: [Id <System.Int64>], [Url <System.String>], [Name <System.String>], [Role <System.String[]>], [Content <UniversalDashboard.Models.Endpoint>], [Description <System.String>], [DefaultHomePage <System.Boolean>], [Title <System.String>], [Blank <System.Boolean>], [Loading <System.String>], [NavLayout <System.String>], [Navigation <System.Collections.Hashtable[]>], [Logo <System.String>], [LoadNavigation <UniversalDashboard.Models.Endpoint>], [HeaderPosition <System.String>], [HeaderColor <System.String>], [HeaderBackgroundColor <System.String>], [HeaderContent <UniversalDashboard.Models.Endpoint>], [HideUserName <System.Boolean>], [Icon <System.Collections.Hashtable>], [HideNavigation <System.Boolean>], [LoadTitle <UniversalDashboard.Models.Endpoint>], [ComponentId <System.String>], [DashboardId <System.Int64>], [Static <System.Boolean>], [Generated <System.Boolean>], [Layout <PowerShellUniversal.DesignerPageLayout>].

I’m still getting this after nuking my modules folder, and my db.
Feel like something I’m doing is breaking the built in modules somehow.
The only thing I would mention is I’ve got -PSModulePath on my integrated environment pointed to /Data/Repository/Modules.

Anyway, I figured I’d give it a try upgrading back to 4.0.2 again now, seeing if that fixes the issue.


Still getting a similar error on my test page.
But the original problem with getting into the Powershell Universal Modules menu is back, it just throws a big red error across the page and I cant get there.
Also I noticed that my modules currently arnt importing:

Despite the path being the same in my environment file, and those modules being there.

TL;DR: pretty sure there’s a bug in 4.0.2 getting to Powershell Universal Modules menu. But I also thing I’ve got a few other things going on in my setup that may or may not be bugs and could just be something I’m doing wrong.

Just created a terminal using the integrated environment and ran get-module -listavailable and all my modules are showing. So it looks like the dashboard isnt auto loading them for some reason.

Currently in the process of a bit of trial and error so will report back.
I’m stripping everything out, removing all modules, nuking the DB, removing anything else other than a plain app with a plain hello world page.

I’ll add things one by one back in from there and see if I can figure out if there’s anything in particular breaking it.

I’m at a complete loss lol. I’ve stripped it right back, nothing in my modules folder, no scripts or anything else, clean DB, just a plain app with this in the code:

$AppSplat = @{
    Title = 'Test'
    DisableThemeToggle = $true
}

New-UDApp @AppSplat -Content {
    New-UDPage -name "Home"  -Content {
        New-UDHtml -Markup "Hello world"
    }
}

I’ve even removed the PSModulePath from my environments.ps1.

Currently on load / after restarting my web app, I’m getting the following:

And my New-UDHtml -markup isnt working / the loaded dashboard is just empty.

As for errors in my log file, there’s lots of this, but cant see anything else:
2023-06-30 11:16:14.220 +01:00 [WRN] Error unprotecting the session cookie.
System.Security.Cryptography.CryptographicException: The key {8c84ffd2-2746-4fc7-8b1c-f4b85ec7d64f} was not found in the key ring.

At this point I think I’m about to just burn it all to the ground and rebuild from scratch with terraform then pull my repository folder from git :man_shrugging: :sweat_smile:

Okay, last update for now.
I’ve used terraform to rebuild from scratch and restored repository files from git and it’s working as before without error or issue.
Honestly I’m baffled how I managed to get it so muddled by fudging around with modules.
I’ll step through a few changes in a bit as I’m still missing one or two modules yet, but if I figure out the cause I’ll update this thread.

After a reboot, module auto loading is broken again… getting errors with the Az modules

"Could not load file or assembly 'Microsoft.Azure.PowerShell.AssemblyLoading, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified." 

Odd since it worked on first install (and it’s been working for the past couple of days), but just not after I restarted now.
I read that the above can be caused by version mismatches between the sub modules - might be a result of me installing them individually rather than just the top level Az.
Copied them from my machine instead and its now working fine - possible that also contributed to my earlier problems.