Intermittent 'Invalid configuration: dashboards.ps1' Error

Product: PowerShell Universal
Version: 3.7.10

I have this problem where when reloading my dashboard I intermittently get the following notification error:

Invalid configuration: dashboards.ps1
Invalid URI: The format of the URI could not be determined.

Whenever I get this error I also receive a hanging dashboard, I have to reload to get to work.

Has anyone seen this before?

My new-psudashboard line is the following:

New-PSUDashboard -Name "My-Dash" -FilePath "dashboards/My-Dash/My-Dash.ps1" -BaseUrl "/mydash" -Authenticated -AutoDeploy

I haven’t but can you check your PSU log file? It seems like we may be putting together an invalid path.

Hi @adam,

Thank you for replying :slight_smile:

the logs set to Error logging show me this repeatidly:

2023-02-08 09:36:42.311 +00:00 [ERR] An unhandled exception has occurred while executing the request.
System.Exception: dashboardid header not found.
   at Universal.Server.Utilities.HttpContextExtensions.GetDashboardId(HttpContext context) in C:\actions-runner\_work\universal\universal\src\Universal.Server\Utilities\HttpContextExtensions.cs:line 26
   at PowerShellProTools.UniversalDashboard.Controllers.JavaScriptController.Index(String asset) in C:\actions-runner\_work\universal\universal\src\Universal.Server\Controllers\JavaScriptController.cs:line 59
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   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|25_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.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.AuthorizationMiddleware.Invoke(HttpContext context)
   at PowerShellUniversal.FeatureMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) in C:\actions-runner\_work\universal\universal\src\Universal.Server\Middleware\FeatureMiddleware.cs:line 43
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at PowerShellUniversal.DisallowedModeMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) in C:\actions-runner\_work\universal\universal\src\Universal.Server\Middleware\ModeMiddleware.cs:line 47
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at Universal.Server.Middleware.RoutingMiddleware.Invoke(HttpContext httpContext, IPolicyEvaluator policyEvaluator) in C:\actions-runner\_work\universal\universal\src\Universal.Server\Middleware\RoutingMiddleware.cs:line 172
   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 C:\actions-runner\_work\universal\universal\src\Universal.Server\Middleware\SwaggerAuthMiddleware.cs:line 37
   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 C:\actions-runner\_work\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)

Further PD based on those logs has lead me to this forum post: Issue in PSU 3.6.0 affecting home page from loading when using header content

I have -HeaderContent im my New-UDDashboard command.

It looks like removing -HeaderContent does not fix the issue

Interesting. Can you check out the network tab in your browser? (F12). It seems like the request made to the JS controller doesn’t include the dashboardid header.

Hi @adam ,

I can see the following…


Looking in to this a little deeper, When I inspect the JS script it highlights the following:

2023-02-09 17_39_42-DevTools - deviacloud.ia-cloud.io_iacloud_eula

I am beginning to wonder if once a TCP socket has been connected Websocket.js is trying to establish a new connection to switch from HTTP to Websocket’s and this is where its hanging.

I do briefly see other objects show a status of 101 then move to 200 however the websocket remains in a pending state.

That’s expected for a web socket connection. It makes a 101 to switch protocols and then, while connected, will always be in a pending state.

The error message is coming from the JavaScript controller so I would expect it to be one of the JS files loading causing this issue.

Thanks for the info, ill start looking into JS packages.