Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Failed to generate a unique workflow name after 100 attempts #29

Closed
schneidersympatient opened this issue Aug 23, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@schneidersympatient
Copy link

Hi,
whenever I try to use a custom v3 server, as explained in the docs (e.g. here: https://v3.elsaworkflows.io/docs/installation/elsa-server) ElsaStudio fails when trying to create a new Workflow:

 System.Exception: Failed to generate a unique workflow name after 100 attempts.
         at Elsa.Studio.Workflows.Domain.Services.RemoteWorkflowDefinitionService.GenerateUniqueNameAsync(CancellationToken cancellationToken)
         at Elsa.Studio.Workflows.Pages.WorkflowDefinitions.List.Index.OnCreateWorkflowClicked()
         at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
         at MudBlazor.MudBaseButton.OnClickHandler(MouseEventArgs ev)
         at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
         at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)

It's working when I start the server from the sources, as explained in #18 . However I'd like to host my own server, in order to be independent from the original server repository.

Here are my dependencies. I'm using the feedz.io packages for ElsaStudio.

  <ItemGroup>
    <PackageReference Include="Elsa" Version="3.0.0-preview.660" />
    <PackageReference Include="Elsa.Http" Version="3.0.0-preview.660" />
    <PackageReference Include="Elsa.Identity" Version="3.0.0-preview.660" />
    <PackageReference Include="Elsa.Studio" Version="3.0.0-preview.78" />
    <PackageReference Include="Elsa.Studio.BlazorServer" Version="3.0.0-preview.71" />
    <PackageReference Include="Elsa.Studio.Core.BlazorServer" Version="3.0.0-preview.78" />
    <PackageReference Include="Elsa.Studio.Login" Version="3.0.0-preview.78" />
    <PackageReference Include="Elsa.Studio.Login.BlazorServer" Version="3.0.0-preview.78" />
    <PackageReference Include="Elsa.Studio.Security" Version="3.0.0-preview.78" />
    <PackageReference Include="Elsa.Studio.Webhooks" Version="3.0.0-preview.78" />
    <PackageReference Include="Elsa.Webhooks" Version="3.0.0-preview.660" />
    <PackageReference Include="Elsa.Workflows.Api" Version="3.0.0-preview.660" />
    <PackageReference Include="Elsa.Workflows.Designer" Version="3.0.0-preview.660" />
  </ItemGroup>

Any help is appreciated.

@sfmskywalker
Copy link
Member

Yep, makes sense. Although I don't think it matters, but just for my understanding: are you hosting Elsa Studio and Elsa Server from the same ASP.NET Core project, or are you keeping them in separate projects?

I noticed that your dependencies for Elsa Studio use some mixed package versions, plus packages that wouldn't be necessary if you're only hosting the Elsa Studio and not Elsa Server. For Elsa Studio, I think you need to remove all but these:

<ItemGroup>
    <PackageReference Include="Elsa.Studio" Version="3.0.0-preview.78" />
    <PackageReference Include="Elsa.Studio.Core.BlazorServer" Version="3.0.0-preview.78" />
    <PackageReference Include="Elsa.Studio.Login.BlazorServer" Version="3.0.0-preview.78" />
  </ItemGroup>

The other packages are either deprecated, not implemented or intended for Elsa Server only.

@sfmskywalker sfmskywalker added the bug Something isn't working label Aug 24, 2023
@sfmskywalker sfmskywalker changed the title Failed to generate a unique workflow name after 100 attempts Bug: Failed to generate a unique workflow name after 100 attempts Aug 24, 2023
@schneidersympatient
Copy link
Author

I'm hosting Elsa Server and Studio from the same project.

I've now updated the dependencies to these, with minimal ElsaStudio dependencies:

  <ItemGroup>
    <PackageReference Include="Elsa" Version="3.0.0-preview.660" />
    <PackageReference Include="Elsa.Http" Version="3.0.0-preview.660" />
    <PackageReference Include="Elsa.Identity" Version="3.0.0-preview.660" />
    <PackageReference Include="Elsa.Studio" Version="3.0.0-preview.78" />
    <PackageReference Include="Elsa.Studio.Core.BlazorServer" Version="3.0.0-preview.78" />
    <PackageReference Include="Elsa.Studio.Login.BlazorServer" Version="3.0.0-preview.78" />
    <PackageReference Include="Elsa.Webhooks" Version="3.0.0-preview.660" />
    <PackageReference Include="Elsa.Workflows.Api" Version="3.0.0-preview.660" />
    <PackageReference Include="Elsa.Workflows.Designer" Version="3.0.0-preview.660" />
  </ItemGroup>

my Program.cs. There also might be some useless/duplicated stuff

using Elsa.Extensions;
using Elsa.Studio.Backend.Extensions;
using Elsa.Studio.Core.BlazorServer.Extensions;
using Elsa.Studio.Dashboard.Extensions;
using Elsa.Studio.Login.BlazorServer.Extensions;
using Elsa.Studio.Shell.Extensions;
using Elsa.Studio.Workflows.Designer.Extensions;
using Elsa.Studio.Workflows.Extensions;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.
builder.Services.AddControllers();
builder.Services.AddRazorPages();
builder.Services.AddCors(cors => cors.AddDefaultPolicy(policy => policy.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod()));

//
builder.Services.AddServerSideBlazor(options =>
{
    // Register the root components.
    options.RootComponents.RegisterCustomElsaStudioElements();
});
builder.Services.AddCore();
builder.Services.AddShell(options => builder.Configuration.GetSection("Shell").Bind(options));
builder.Services.AddRemoteBackendModule(options => builder.Configuration.GetSection("Backend").Bind(options));
builder.Services.AddLoginModule();
builder.Services.AddDashboardModule();
builder.Services.AddWorkflowsModule();


builder.Services.AddElsa(elsa =>
{
    elsa.UseIdentity(identity =>
    {
        identity.UseAdminUserProvider();
        identity.TokenOptions = options => options.SigningKey = "secret-token-signing-key";
    });
    elsa.UseDefaultAuthentication();
    //elsa.UseWorkflowManagement(management => management.UseEntityFrameworkCore(m => m.UseSqlite()));
    elsa.UseJavaScript();
    elsa.UseLiquid();
    elsa.UseWorkflowsApi();
    elsa.UseHttp(http => http.ConfigureHttpOptions = options => options.BasePath = "/wf");
});

// Configure SignalR.
builder.Services.AddSignalR(options =>
{
    // Set MaximumReceiveMessageSize:
    options.MaximumReceiveMessageSize = 5 * 1024 * 1000; // 5MB
});

//var app = builder.Build();
var app = builder.Build();

// Configure the HTTP request pipeline.
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseWorkflowsApi();
app.UseWorkflows();
app.MapControllers();
app.MapRazorPages();
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.MapBlazorHub();
app.MapFallbackToPage("/_Host");
app.Run();

@sfmskywalker
Copy link
Member

OK. Would it be possible for you to share your (stripped down if necessary) solution so I an take a closer look?

@schneidersympatient
Copy link
Author

schneidersympatient commented Aug 25, 2023

Hope this works https://github.com/schneidersympatient/elsa-bug-workflow-attempts
I'm using the Elsa-Server https configuration for startup.

@sfmskywalker
Copy link
Member

@schneidersympatient I haven't had a chance yet to look into it, but it's possible that the fix from @yspanj solved the issue. If not, please let me know and we'll leave this issue open for fixing.

@schneidersympatient
Copy link
Author

Yes, that fixed it, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants