Hi there
I’m trying to switch from PowerShell 5.1 to 7
But since that, I have the issues, that nothing with -Endpoint
works…
$Pages =@()
$HomePage = New-UDPage -Icon home -url "/Home" -Endpoint {
New-UDElement -Tag div -Content {"Home"}
if ($Session:UserDefined -eq "true") {
New-UDElement -tag div -Content {"Do something"}
}
}
$HomePage.Name = "Home"
$Pages += $HomePage
$Dashboard = New-UDDashboard -Title "Global Servers" -Pages $Pages
Start-UDDashboard -Dashboard $Dashboard -Port 10000 -Name GlobalDaemonServices -Force
Did I miss anything?
Thanks in advance
Hi @SwissResl,
Thats weird, does the logs show any relevant information?
Enable-UDLogging -path C:\temp\udlog.txt -level 'debug'
The command above will enable logging to the specified folder.
Hi @BoSen29
It seems to be because of a module warning, which is spit out in pwsh but not in PowerShell.
I even don’t load this module
09:14:04 [Warn] ComponentController RunScript() Module AWS.Tools.Common version 4.0.5.0 failed importing. AWS.Tools.Common version 4.0.5.0 is currently imported. Only a single version of a single variant of AWS Tools for PowerShell (AWSPowerShell, AWSPowerShell.NetCore or AWS.Tools.Common) can be imported at any time.
at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
at System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)
at System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync)
at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
at System.Management.Automation.PowerShell.Invoke(IEnumerable input, PSInvocationSettings settings)
at System.Management.Automation.Runspaces.InitialSessionState.ProcessOneModule(Runspace initializedRunspace, String name, PSModuleInfo moduleInfoToLoad, String path, HashSet`1 publicCommands)
at System.Management.Automation.Runspaces.InitialSessionState.ProcessModulesToImport(Runspace initializedRunspace, IEnumerable moduleList, String path, HashSet`1 publicCommands, HashSet`1 unresolvedCmdsToExpose)
at System.Management.Automation.Runspaces.InitialSessionState.BindRunspace(Runspace initializedRunspace, PSTraceSource runspaceInitTracer)
at System.Management.Automation.Runspaces.LocalRunspace.DoOpenHelper()
at System.Management.Automation.Runspaces.RunspaceBase.CoreOpen(Boolean syncCall)
at UniversalDashboard.Services.UDRunspaceFactory.CreateRunspace() in D:\a\1\s\src\UniversalDashboard\Services\UDRunspaceFactory.cs:line 105
at UniversalDashboard.Services.ObjectPool`1.CreateInstance() in D:\a\1\s\src\UniversalDashboard\Services\ObjectPool.cs:line 69
at UniversalDashboard.Services.ObjectPool`1.AllocateSlow() in D:\a\1\s\src\UniversalDashboard\Services\ObjectPool.cs:line 115
at UniversalDashboard.Services.ObjectPool`1.Allocate() in D:\a\1\s\src\UniversalDashboard\Services\ObjectPool.cs:line 93
at UniversalDashboard.Services.UDRunspaceFactory.GetRunspace() in D:\a\1\s\src\UniversalDashboard\Services\UDRunspaceFactory.cs:line 61
at UniversalDashboard.Execution.PowerShellExecutionService.ExecuteEndpoint(ExecutionContext context, AbstractEndpoint endpoint) in D:\a\1\s\src\UniversalDashboard\Execution\PowerShellExecutionService.cs:line 222
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location where exception was thrown ---
at UniversalDashboard.Execution.PowerShellExecutionService.ExecuteEndpointAsync(ExecutionContext context, AbstractEndpoint endpoint) in D:\a\1\s\src\UniversalDashboard\Execution\PowerShellExecutionService.cs:line 62
at UniversalDashboard.Execution.ExecutionService.ExecuteEndpointAsync(ExecutionContext context, AbstractEndpoint endpoint) in D:\a\1\s\src\UniversalDashboard\Execution\ExecutionService.cs:line 30
at UniversalDashboard.Controllers.ComponentController.RunScript(AbstractEndpoint endpoint, Dictionary`2 parameters, Boolean noSerialization) in D:\a\1\s\src\UniversalDashboard\Controllers\ComponentController.cs:line 92
Hi again @SwissResl,
Hopefully said module is in our Endpointinit, and declared twice?
If not, could you give it a go with a minimalistic dashboard, and attempt with v7?
I get this error with the dashboard mentioned in the OP
As soon as I have an UD Element with an -Endpoint
it is stopping to work.
If I have only UD Elements with -Content
Parameter, all is working fine
Dashboard
$Pages =@()
$HomePage = New-UDPage -Icon home -url "/Home" -Endpoint {
New-UDElement -Tag div -Content {"Home"}
if ($Session:UserDefined -eq "true") {
New-UDElement -tag div -Content {"Do something"}
}
}
$HomePage.Name = "Home"
$Pages += $HomePage
$Dashboard = New-UDDashboard -Title "Global Servers" -Pages $Pages
Start-UDDashboard -Dashboard $Dashboard -Port 10000 -Name GlobalDaemonServices -Force
@SwissResl,
Thats weird,
I’m asuming you’re hosting in CLI? Does your profile have said modules included?
Could you do a Get-Module for me ?