Hi, I've had this solution working on a previous version but after migrating to the latest I'm getting an error and I've not been to resolve it and I'm running out of ideas. So any help will be appreciated.
I have an API endpoint that I use to refresh a dashboard component. The dashboard is running in the Integrated environment as is the endpoint.
New-PSUEndpoint -Url "/refresh" -Description "Refresh" -Method @('GET') -Endpoint {
try {
Sync-PSUComponent -Integrated -Id "Import" -Broadcast
"[Dashboard Refreshed]"
}
catch {
"[Dashboard Refresh Failed]"
$_
}
} -Environment "Integrated"
When I call the API Endpoint I get an error with this exception
TargetSite : @{Name=IPublicClient.SyncComponent; DeclaringType=; ReflectedType=; MemberType=8; MetadataToken=100664704; Module=; IsSecurityCritical=True; IsSecuritySafeCritical=False; IsSecurityTransparent=False; MethodHandle=; Attributes=481; CallingConvention=33; ReturnType=; ReturnTypeCustomAttributes=; ReturnParameter=;
IsCollectible=True; IsGenericMethod=False; IsGenericMethodDefinition=False; ContainsGenericParameters=False; MethodImplementationFlags=0; IsAbstract=False; IsConstructor=False; IsFinal=True; IsHideBySig=True; IsSpecialName=False; IsStatic=False; IsVirtual=True; IsAssembly=False; IsFamily=False;
IsFamilyAndAssembly=False; IsFamilyOrAssembly=False; IsPrivate=True; IsPublic=False; IsConstructedGenericMethod=False; CustomAttributes=System.Object[]}
Message : Specified method is not supported.
Data :
InnerException :
HelpLink :
Source : ProtoBuf.Grpc.Internal.Proxies
HResult : -2146233067
StackTrace : at ProtoBuf.Grpc.Internal.Proxies.ClientBase.IPublicClient_Proxy_51.IPublicClient.SyncComponent(StringRequest, Boolean)
at Universal.SyncComponentCommand.ProcessRecord() in D:\a\powershell-universal\powershell-universal\src\Cmdlets\Apps\SyncComponentCommand.cs:line 17
at System.Management.Automation.CommandProcessor.ProcessRecord()@cdawson I can reproduce this issue and it looks like a problem with the service interface that we will need to resolve. I've opened an issue so that we can get a fix into an upcoming version. It is possible to workaround this but would require an admin app token to do so. You could store the app token in a secret as to not have it plaintext in the endpoint definition.
Invoke-RestMethod http://localhost:5000/api/v1/component/Import/sync?broadcast=true -Headers @{
Authorization = "Bearer $Secret:AdminToken"
}Adam Driscoll
PowerShell Expert and Developer at Devolutions
@cdawson I can reproduce this issue and it looks like a problem with the service interface that we will need to resolve. I've opened an issue so that we can get a fix into an upcoming version. It is possible to workaround this but would require an admin app token to do so. You could store the app token in a secret as to not have it plaintext in the endpoint definition.
Invoke-RestMethod http://localhost:5000/api/v1/component/Import/sync?broadcast=true -Headers @{
Authorization = "Bearer $Secret:AdminToken"
}
Hi @Adam Driscoll Thanks for looking at this.
I get a 'Response status code does not indicate success: 405 (Method Not Allowed)' if I try that call with an admin token, not to worry though, happy to wait for the fix
@cdawson I should have included a -Method PUT in that HTTP call. Sorry about that. Either way, I will update this post once we have a fix prepared.
Adam Driscoll
PowerShell Expert and Developer at Devolutions