Dashboards not loading after upgrading to 2.9.0 from 2.8.0

Our dashboards are no longer loading after upgrading to PowerShell Universal 2.9.0 from 2.8.0. We see the dashboards folders and files listed under:

C:\ProgramData\UniversalAutomation\Repository\dashboards

Also, the dashboards are listed in the dashboards.ps1 configuration file.

The browser dev tools show some 500 Internal Server errors when making a call to the Request URL: https://psuniversal.ad.corp.local/api/v1/dashboardframework/newest

The dashboards also no longer load in the VS Code extension.

As far as we can see, all other artifacts do load up fine; to date only the dashboards are impacted.

Browsing directly to a dashboard URL returns a 404.

The log file shows the following error which correlates with the time stamp of when I try to access the dashboard page:

2022-03-03 08:39:10.586 -05:00 [ERR] An unhandled exception has occurred while executing the request.
System.InvalidOperationException: Sequence contains no elements
   at System.Linq.ThrowHelper.ThrowNoElementsException()
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
   at lambda_method1524(Closure , Object , Object[] )
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Microsoft.AspNetCore.Authorization.Policy.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)
   at Universal.Server.Middleware.RoutingMiddleware.Invoke(HttpContext httpContext, IPolicyEvaluator policyEvaluator) in D:\a\universal\universal\src\Universal.Server\Middleware\RoutingMiddleware.cs:line 153
   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
   at Universal.Server.Middleware.SwaggerAuthenticationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) in D:\a\universal\universal\src\Universal.Server\Middleware\SwaggerAuthMiddleware.cs:line 42
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at AspNetCoreRateLimit.RateLimitMiddleware`1.Invoke(HttpContext context) in D:\a\universal\universal\src\AspNetCoreRateLimit\Middleware\RateLimitMiddleware.cs:line 109
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)
2022-03-03 08:39:10.594 -05:00 [WRN] No exception handler was found, rethrowing original exception.
2022-03-03 08:39:10.597 -05:00 [ERR] Connection id "0HMFSIEU059OS", Request id "0HMFSIEU059OS:0000000A": An unhandled exception was thrown by the application.
System.InvalidOperationException: Sequence contains no elements
   at System.Linq.ThrowHelper.ThrowNoElementsException()
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
   at lambda_method1524(Closure , Object , Object[] )
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Microsoft.AspNetCore.Authorization.Policy.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)
   at Universal.Server.Middleware.RoutingMiddleware.Invoke(HttpContext httpContext, IPolicyEvaluator policyEvaluator) in D:\a\universal\universal\src\Universal.Server\Middleware\RoutingMiddleware.cs:line 153
   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
   at Universal.Server.Middleware.SwaggerAuthenticationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) in D:\a\universal\universal\src\Universal.Server\Middleware\SwaggerAuthMiddleware.cs:line 42
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at AspNetCoreRateLimit.RateLimitMiddleware`1.Invoke(HttpContext context) in D:\a\universal\universal\src\AspNetCoreRateLimit\Middleware\RateLimitMiddleware.cs:line 109
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.HandleException(HttpContext context, ExceptionDispatchInfo edi)
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)
   at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Server.IISIntegration.IISMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)

Any thoughts on how to resolve this?

Thank you.

Product: PowerShell Universal
Version: 2.9.0
2 Likes

We are also experiencing this just having upgraded from 2.7.3 → 2.8.3

I removed -Component @(“UniversalDashboard.Style:1.0.0”) from the dashboards.ps1 and it loaded up!

1 Like

Hmm… spoke too soon. It was enough to get the list loaded but I still can’t save/view them

Thank you for the insight. Also removed the -Component and now also see the dashboards listed at least - so a step forward! However, I got a “This page isn’t working right now” error when trying to view the dashboard. Also see a bunch of React errors when trying to view the details, i.e. Settings, Log, Console, Endpoint, Sessions, Modules - all return the same error.

Also, the same errors if I try to edit the dashboard properties. Trying to create a new dashboard returns an “Object reference not set to an instance of an object” message and a 400 Bad Request error.

Thanks.

Can you let me know what’s listed in your frameworks and components pages?

Note that v2.9 will no longer list the built in components because they are automatically included with dashboards. Because you are upgrading, you may see old versions of components listed here.

v2.8.3 will still list the components.

One thing I may recommend is to clean out the C:\ProgramData\PowerShellUniversal\Dashboard folder of old versions of the PSU frameworks and components you are using.

Mine’s empty…

I’ll remove the old versions and see what’s what:
image

Same here:

Going to clear the C:\ProgramData\PowerShellUniversal\Dashboard and get back.

Upon refresh I was able to get the console log for one of the new dashboards I was somehow able to add earlier today (which removed all the others, mind you…)

“Startup: The term ‘New-UDDashboard’ is not recognized as a name of a cmdlet, function, script file, or executable program.”

Sure enough, I don’t see it in the list of exported commands

I got a bit farther in the console after running install-module UniversalDashboard on the server itself but it’s still throwing 500 errors and not behaving properly.

Old versions were removed from the folder with no change to the dashboard

Got rid of the old versions of the PSU frameworks and components and restarted but no luck. Also, the dashboards are no longer listed either:

Still could not create a new dashboard with this change.

So I added the folders back (had backed them up) and restarted, but did not restore dashboards list yet.

The New-PSUDashboard in dashboards.ps1 has a -Framework “UniversalDashboard:Latest” property - should it be targeting a specific version maybe?

We ended up reverting back to 2.7.3, which resolved the issue, and will be upgrading to 2.8.0 shortly to ensure it’s still working on that version.

EDIT: 2.8.0 is functioning fine.

We went back to 2.8.0 and dashboards are all working now.

1 Like

I have upgraded to latest 2.9.0 nightly and have no issues everything works great.
you might need to check your dashboard.ps1 file and remove -component and its attributes as adam mentioned earlier there is no need for this switch since its been already automated and loaded right away which is a great enhancement.

FYI am hosting in IIS.

1 Like

I have opened a issue for this at GitHub previous week.
2.9 don’t reload dashboard you need to restart the service

1 Like

Looked again at dashboards.ps1 and made sure no reference to -Component:

New-PSUDashboard -Name "<Name>" -FilePath "dashboards\<Folder>\<Name>.ps1" -BaseUrl "/<URL>" -Framework "UniversalDashboard:Latest" -Environment "Windows PowerShell 5.1" -Authenticated -GrantAppToken -SessionTimeout 0 -Description "<DESC>" -Credential "Default" -Tag @("<Tag 1>", "<Tag 2>", "<Tag 3>", "<Tag 4>")

Used 2.9.0 and restarted everything (hosted in IIS) but dashboards still not loading and unable to create new dashboards. Reverted to 2.8.0 and everything is working again.

@rehan
There has to be something wrong in your code somewhere since the same package works for me and others.
how are you doing the upgrade? are you replacing all files or overwrite existing

Yes, sounds like something local given 2.9.0 works for others. The upgrade process followed (IIS hosted) to replace files:

  • Stop IIS Site
  • Stop App Pool
  • Rename C:\inetpub\PSUniversal to C:\inetpub\PSUniversal-X.X.X (for the old version #)
  • Backup C:\ProgramData\UniversalAutomation
  • Create C:\inetpub\PSUniversal folder and extract new build there
  • Run Get-ChildItem C:\inetpub\PSUniversal -Recurse | Unblock-File
  • Update C:\inetpub\PSUniversal\appsettings.json from old site
  • Update C:\inetpub\PSUniversal\web.config from old site
  • Start App Pool
  • Start IIS Site

Reviewing all the dashboards and settings again to see what might have been missed.

@rehan
try this as well
stop-apppool
delete C:\ProgramData\PowershellUniversal
start-apppool and test

Tried:

  • clearing C:\ProgramData\PowerShellUniversal and restarting but same issue.
  • clearing dashboards.ps1 altogether and starting with an empty file, but not able to create a new dashboard.

Going to download 2.9.0 nightly build again and re-try update later. In the interim, using 2.8.0 so users can access the dashboards.

We had this same issue going from 2.7.3 to 2.8.x. For us it ended up being a module we were trying to import that didn’t exist. The logs were referencing a .psm1 file at a path at it wasn’t there. The weird thing was we couldn’t find where it was being referenced from. I ended up just creating an empty psm1 file at the location and that fixed it. I couldn’t believe that was causing all the issues but it was. Same symptoms as you were having.

1 Like

Thank you very much - this worked for us! Searched log for .psm1 and found:

System.IO.FileNotFoundException: Could not find file ‘C:\ProgramData\UniversalAutomation\Repository\Modules\AzureAD\2.0.2.140\AzureAD.psm1’.

Added the empty AzureAD.psm1 file as you suggested, switch to 2.9.0 and now dashboards are all working.

Thank you everyone for your help and insights.

2 Likes