bitfoundation / bitplatform

Build all of your apps using what you already know and love ❤️
https://bitplatform.dev
MIT License
1.04k stars 216 forks source link

Authentication breaks when Health checks enabled - AdminPanel Sample #7783

Closed benbarnett02 closed 1 week ago

benbarnett02 commented 3 weeks ago

Is there an existing issue for this?

Describe the bug

When health checks are enabled via appsettings.json, attempting to sign in using the demo credentials (or any credentials) results in an error. This has been reproduced in a brand-new project using the Boilerplate template, with the AdminPanel sample installed.

Expected Behavior

Sign in correctly despite health checks being enabled.

Steps To Reproduce

Repro project: https://github.com/benbarnett02/AuthenticationIssueAdminPanel

Steps to reproduce:

  1. Make a new solution using the boilerplate template. Add the adminpanel template.
  2. Set up the project (database migration etc)
  3. Enable health checks in appsettings. (EnableHealthChecks : true)
  4. run the server project, and attempt to sign in with the /sign-in page. Use the test@bitplatform.dev and 123456 demo credentials.
  5. Error shown.

Exceptions (if any)

System.InvalidOperationException: An invalid request URI was provided. Either the request URI must be an absolute URI or BaseAddress must be set.
   at System.Net.Http.HttpClient.PrepareRequestMessage(HttpRequestMessage request)
   at System.Net.Http.HttpClient.SendAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken)
   at Microsoft.Extensions.DependencyInjection.IHttpClientServiceCollectionExtensions.IdentityController.<>c__DisplayClass12_0.<<SignIn>b__0>d.MoveNext() in E:\MinRep\src\Client\MinRep.Client.Core\obj\Debug\net8.0\Bit.SourceGenerators\Bit.SourceGenerators.HttpClientProxySourceGenerator\HttpClientProxy.cs:line 382
--- End of stack trace from previous location ---
   at MinRep.Client.Core.Services.PrerenderStateService.GetValue[T](String key, Func`1 factory) in E:\MinRep\src\Client\MinRep.Client.Core\Services\PrerenderStateService.cs:line 37
   at Microsoft.Extensions.DependencyInjection.IHttpClientServiceCollectionExtensions.IdentityController.SignIn(SignInRequestDto request, CancellationToken cancellationToken) in E:\MinRep\src\Client\MinRep.Client.Core\obj\Debug\net8.0\Bit.SourceGenerators\Bit.SourceGenerators.HttpClientProxySourceGenerator\HttpClientProxy.cs:line 378
   at MinRep.Client.Core.Services.AuthenticationManager.SignIn(SignInRequestDto request, CancellationToken cancellationToken) in E:\MinRep\src\Client\MinRep.Client.Core\Services\AuthenticationManager.cs:line 20
   at MinRep.Client.Core.Components.Pages.Identity.SignInPage.DoSignIn() in E:\MinRep\src\Client\MinRep.Client.Core\Components\Pages\Identity\SignInPage.razor.cs:line 87
   at MinRep.Client.Core.Components.AppComponentBase.<>c__DisplayClass30_0.<<WrapHandled>b__0>d.MoveNext() in E:\MinRep\src\Client\MinRep.Client.Core\Components\AppComponentBase.cs:line 169

.NET Version

8.0.300

Anything else?

Also tested in dotnet 9.0.100 Preview 5 with same issue.

msynk commented 3 weeks ago

@benbarnett02 Thanks for contacting us. We're investigating this issue. We'll let you know if it's possible to work on this issue.

msynk commented 1 week ago

@benbarnett02 after some investigations and internal discussions, we've decided to remove the current health-check implementation in favor of adding the .NET Aspire to the project template in the near future.

so this problem does not exist anymore since we've removed the problematic health-check implementation in PR #7808.