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] Error Occurs When Resuming Bookmark, Workflow Fails to Resume #6280

Open
Angus221 opened this issue Jan 8, 2025 · 1 comment
Open
Labels
bug Something isn't working

Comments

@Angus221
Copy link

Angus221 commented Jan 8, 2025

Description

An error occurs when attempting to resume a suspended bookmark using the Elsa workflow framework, preventing the workflow from resuming successfully. Below is the detailed error stack trace.

Steps to Reproduce

To help us identify the issue more quickly, please follow these guidelines:

  1. Detailed Steps: Provide a step-by-step description of what leads to the bug. Be as specific as possible.

  2. Code Snippets:

protected override async ValueTask ExecuteAsync(ActivityExecutionContext context)
{
 
    var eventName = EventName.Get(context) ?? "";


    if (!context.IsTriggerOfWorkflow())
    {
        var book = new CreateBookmarkArgs()
        {
            Payload = eventName,
            Callback = OnResumeAsync
        };

        context.CreateBookmark(book);
        return;
    }


    await context.CompleteActivityAsync();
}

ResumeWorkflows code

   var   activityTypeName=ActivityTypeNameHelper.GenerateTypeName<FlowEvent>();
    await _workflowRuntime.ResumeWorkflowsAsync(activityTypeName, bookMark, options);

Error Stack Trace:

at Elsa.Workflows.Services.ActivityFactory.ReadSyntheticInputs(ActivityDescriptor activityDescriptor, IActivity activity, JsonElement activityRoot, JsonSerializerOptions options)
   at Elsa.Workflows.Services.ActivityFactory.Create(Type type, ActivityConstructorContext context)
   at Elsa.Workflows.Serialization.Converters.ActivityJsonConverter.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 json, JsonTypeInfo`1 jsonTypeInfo)
   at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonSerializerOptions options)
   at Elsa.Workflows.Serialization.Serializers.JsonActivitySerializer.Deserialize(String serializedActivity)
   at Elsa.Workflows.Management.Mappers.WorkflowDefinitionMapper.Map(WorkflowDefinition source)
   at Elsa.Workflows.Management.Materializers.JsonWorkflowMaterializer.ToWorkflow(WorkflowDefinition definition)
   at Elsa.Workflows.Management.Materializers.JsonWorkflowMaterializer.MaterializeAsync(WorkflowDefinition definition, CancellationToken cancellationToken)
   at Elsa.Workflows.Management.Services.WorkflowDefinitionService.<MaterializeWorkflowAsync>d__4.MoveNext()
   at Elsa.Workflows.Management.Services.WorkflowDefinitionService.<FindWorkflowGraphAsync>d__8.MoveNext()
   at Elsa.Workflows.Runtime.Services.DefaultWorkflowRuntime.<ResumeWorkflowAsync>d__19.MoveNext()
   at Elsa.Workflows.Runtime.Services.DefaultWorkflowRuntime.<ResumeWorkflowAsync>d__19.MoveNext()
   at Elsa.Workflows.Runtime.Services.DefaultWorkflowRuntime.<ResumeWorkflowsAsync>d__32.MoveNext()
   at Elsa.Workflows.Runtime.Services.DefaultWorkflowRuntime.<ResumeWorkflowsAsync>d__20.MoveNext()
   at Danduola.IOTCoBotOS.Application.Workflow.FlowEvent.FlowEventWapper.<SubEvent>d__7.MoveNext() in E:\work\git\danduola.iotcobotos\API\Danduola.IOTCoBotOS.Application\Workflow\FlowEvent\FlowEventWapper.cs:line 131

Environment:

Elsa Version: [3.2.3]
.NET Version: [..NET 8]
Database Provider: [Sqllite]
Hosting Environment: [Windows]
Additional Context:

Verify if the related activities contain custom fields or use custom types.
There may be issues with the data format of the suspended state or changes in activity definitions.
Suggested Fix or Investigation Areas:

Investigate the ReadSyntheticInputs method and its logic for parsing activity inputs.
Validate if ActivityJsonConverter and JsonSerializerOptions correctly register the required types and converters.
Provide additional documentation or debugging support for bookmark and activity serialization formats.

@Angus221 Angus221 added the bug Something isn't working label Jan 8, 2025
@Angus221 Angus221 changed the title [BUG] [BUG] Error Occurs When Resuming Bookmark, Workflow Fails to Resume Jan 8, 2025
@sfmskywalker
Copy link
Member

Are you able to reproduce this in a small project using the latest 3.3-RC7 packages? If so, please share the project with me and I will troubleshoot the issue. Thanks.

@sfmskywalker sfmskywalker moved this to Triage in ELSA 3 Jan 14, 2025
@sfmskywalker sfmskywalker modified the milestone: Elsa 3.3 Jan 14, 2025
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
Status: Triage
Development

No branches or pull requests

2 participants