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 start workflow when using MSSQL server as persistence provider #5962

Closed
jirimatejka opened this issue Sep 13, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@jirimatejka
Copy link

Description

When starting a workflow from C# rather than from Elsa studio, I am getting a "" message on wfRuntime.StartWorkflowAsync(). See code snippet below.

Steps to Reproduce

I started with an example from https://v3.elsaworkflows.io/docs/installation/elsa-server

and added UseSqlServer option to the builder:

....
builder.Services.AddElsa(elsa =>
{    
    var connString = ""Server=localhost\\SQLExpress;Database=elsa_engine;User=*****;Password=*****;TrustServerCertificate=True";

    // Configure Management layer to use EF Core.
    elsa.UseWorkflowManagement(management => management.UseEntityFrameworkCore(ef => ef.UseSqlServer(connString)));
    
    // Configure Runtime layer to use EF Core.
    elsa.UseWorkflowRuntime(runtime => runtime.UseEntityFrameworkCore(ef => ef.UseSqlServer(connString)));
.....

Then I have a simple Razor page that creates a workflow of given workflow definition id (created a dummy one with just a WriteLine activity):

public class IndexModel(ILogger<IndexModel> logger, IWorkflowRuntime wfRuntime, 
		IWorkflowDefinitionService wfDefinitionService) : PageModel
    {
        private readonly ILogger<IndexModel> _logger = logger;
        public async void OnGet(string wfDefId)
        {        
               
           var result = await wfRuntime.StartWorkflowAsync(wfDefId, pars);
           Debug.WriteLine(result.WorkflowInstanceId);
        }
    }

On calling the wfRuntime.StartWorkflowAsync it throws an exception

'Cannot access a disposed object.
Object name: 'IServiceProvider'.'

  1. Attachments:

    • Workflow JSON: it is not specific to a single workflow definition
  2. Reproduction Rate: 100%

  3. Additional Configuration:
    When I use the default database SqlLite then all works as expected.

Expected Behavior

The workflow starts and an instance is created in DB.

Actual Behavior

The workflow does not start and the workflow instance is not created.

Screenshots

If possible, add screenshots or screen recordings to help explain the problem.

Environment

  • Elsa Package Version: Specify the version. If you've cloned the repo, mention if you are using the latest source code from the main branch.
  • Operating System: Include your OS version (e.g., Windows 10, macOS Big Sur, Ubuntu 18.04).
  • Browser and Version: If applicable, include your browser and version (e.g., Chrome 92).

Log Output

Include any relevant log output or error messages that might help diagnose the issue.

@jirimatejka jirimatejka added the bug Something isn't working label Sep 13, 2024
@jirimatejka
Copy link
Author

Forgot to mention that I am running Elsa 3.2.0

@jirimatejka jirimatejka changed the title [BUG] [BUG] Failed to start workflow when using MSSQL server as persistence provider Sep 13, 2024
@jirimatejka
Copy link
Author

Not a bug.

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

1 participant