Azure / azure-signalr

Azure SignalR Service SDK for .NET
https://aka.ms/signalr-service
MIT License
422 stars 100 forks source link

BlazorServer with AAD Auth - The server which the client is sticky to is not found. #1416

Open ShrenikOne opened 3 years ago

ShrenikOne commented 3 years ago

Application develop using AspNetCore 3.1 and Blazor Server App. Utilizing Azure SignalR Service. When App Server authentication with Azure SignalR service using "AccessKey" then everything works fine, but if use Application's ClientId, ClientSecret it result in exception message on browser as {"error":"The server which the client is sticky to is not found."}.

Application had been given SignalR App Server (PReview) permission described here: https://docs.microsoft.com/en-us/azure/azure-signalr/authorize-access-azure-active-directory?WT.mc_id=Portal-Microsoft_Azure_SignalR, Also attempt to provide all Permission on SignalR resource where permission begin with "SignalR" with assumption that document might have issue, but simply it doesnt work when switch from AccessKey to aad authtype.

It is following documentation of Azure SignalR with Blazor Server App. No Server side error on console, only message in browser and it fails.

AspNet Core Configure method have: .AddSignalR(options => { options.EnableDetailedErrors = Debugger.IsAttached; }) .AddAzureSignalR(options => { options.ServerStickyMode = Microsoft.Azure.SignalR.ServerStickyMode.Required; options.ApplicationName = $"{settings.AzureAd.ApplicationName}{settings.DeploymentEnvironment}{settings.ReleaseType}".ToLowerInvariant(); options.ConnectionString = settings.SignalR.ConnectionString; // This is with clientid then doesnt work but with AccessKey it works??? }) .AddServerSideBlazor(options => { options.DetailedErrors = true; options.DisconnectedCircuitMaxRetained = 100; options.DisconnectedCircuitRetentionPeriod = TimeSpan.FromMinutes(3); options.JSInteropDefaultCallTimeout = TimeSpan.FromMinutes(1); options.MaxBufferedUnacknowledgedRenderBatches = 10; }) .AddHubOptions(options => { options.ClientTimeoutInterval = TimeSpan.FromSeconds(30); options.EnableDetailedErrors = true; options.HandshakeTimeout = TimeSpan.FromSeconds(15); options.KeepAliveInterval = TimeSpan.FromSeconds(15); options.MaximumReceiveMessageSize = 32 * 1024; options.StreamBufferCapacity = 10; })

Client Side Error Message Post Negotiation: {"error":"The server which the client is sticky to is not found."}

Azure SignalR SDK version - 1.9.2

terencefan commented 3 years ago

With 'authType=aad', we use Azure AD Token to connect to our service instead of using AccessToken, which doesn't contain the server name in its claims, results in the failure to find the target server id when negotiating.

We'd like to fix this bug in our future release (1.11.0+)

Sorry for the inconvenience.

terencefan commented 3 years ago

1418

ShrenikOne commented 3 years ago

@terencefan : Thank you for update. Do we have tentative timeline when future release (1.11.0+) expected with this bug fix?

terencefan commented 3 years ago

@ShrenikOne There will be a service deployment next week, which is expected to be done by the end of Sep 17th. So I think the preview version could be released on Sep 22th (Tue), stable version will release a week later than the preview version.

terencefan commented 2 years ago

SDK 1.11.0 has already been released, but it still requires our Runtime deployment, which is in progress and is expected to be completed by the end of this month.