elsa-workflows / elsa-workflows/elsa-guides

src/installation/elsa-studio/ElsaStudioBlazorServer sample does crash at login

Open
#40 0 comments 2 reactions 0 assignees View on GitHub
triaged
Dominant language
C#
Stars
119
Forks
116
PR merge metrics
No merged PRs in 30d

Description

When I download the sample and do want to run it, it doesn't work:

**First**, the `Elsa.Api.Client` nuget is missing from the sample. I can add this myself, no problem.

**Second**, no that the project builds and the login page appears, I can input `admin` and `password`. But then the blazor ui crashes with a `HttpRequestException`.

```
System.Net.Http.HttpRequestException: Es konnte keine Verbindung hergestellt werden, da der Zielcomputer die Verbindung verweigerte. (localhost:5001)
---> System.Net.Sockets.SocketException (10061): Es konnte keine Verbindung hergestellt werden, da der Zielcomputer die Verbindung verweigerte.
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
at System.Net.Sockets.Socket.g__WaitForConnectWithCancellation|281_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(QueueItem queueItem)
at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.HttpConnectionWaiter`1.WaitForConnectionAsync(Boolean async, CancellationToken requestCancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
at Refit.RequestBuilderImplementation.<>c__DisplayClass14_0`2.<b__0>d.MoveNext() in /_/Refit/RequestBuilderImplementation.cs:line 256
--- End of stack trace from previous location ---
at Elsa.Studio.Login.Services.DefaultCredentialsValidator.ValidateCredentialsAsync(String username, String password, CancellationToken cancellationToken)
at Elsa.Studio.Login.Pages.Login.Login.ValidateCredentials(String username, String password)
at Elsa.Studio.Login.Pages.Login.Login.TryLogin()
at Elsa.Studio.Components.StudioComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at Elsa.Studio.Components.StudioComponentBase.InvokeWithBlazorServiceContext(Func`1 func)
at Microsoft.AspNetCore.Components.Forms.EditForm.HandleSubmitAsync()
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost: Error: Unhandled exception in circuit 'PdOc5BnTLF9Q39X-OOnbleQxTZiIJasl0hI1wIr6oGk'.
```

This is probably, because the `appsettings.json` points to `https://localhost:5001/elsa/api` as backend while the server runs on `"applicationUrl": "https://localhost:53214;http://localhost:53215"`.

I can also change this to point to the right endpoint

**Third**, now that appsettings point to the app url, if I try to login again, I get this error:

```
Refit.ApiException: Response status code does not indicate success: 400 (Bad Request).
at Refit.RequestBuilderImplementation.<>c__DisplayClass14_0`2.<b__0>d.MoveNext() in /_/Refit/RequestBuilderImplementation.cs:line 288
--- End of stack trace from previous location ---
at Elsa.Studio.Login.Services.DefaultCredentialsValidator.ValidateCredentialsAsync(String username, String password, CancellationToken cancellationToken)
at Elsa.Studio.Login.Pages.Login.Login.ValidateCredentials(String username, String password)
at Elsa.Studio.Login.Pages.Login.Login.TryLogin()
at Elsa.Studio.Components.StudioComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at Elsa.Studio.Components.StudioComponentBase.InvokeWithBlazorServiceContext(Func`1 func)
at Microsoft.AspNetCore.Components.Forms.EditForm.HandleSubmitAsync()
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost: Error: Unhandled exception in circuit 'd6-nJm9fFXPt3LK-GaQ0Io24RKX-OsV2eQ8qcVJa0gQ'.
```

I have also tried to copy the code directly from the docs, but same result.

Contributor guide

Open the contributing guide

Research direction

Start in src/installation/elsa-studio/ElsaStudioBlazorServer, checking the sample's appsettings.json and project dependencies against the applicationUrl values described in the issue. Run the sample through the login flow and trace the configured backend request; done means the sample builds with its required packages and login no longer produces connection or 400 errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
authentication, full-stack
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.