elsa-workflows / elsa-core

A .NET workflows library
https://v3.elsaworkflows.io/
MIT License
6.24k stars 1.14k forks source link

MongoDB Instances View Internal Server Error #5715

Open gustavoaraujocardozo opened 2 months ago

gustavoaraujocardozo commented 2 months ago

Discussed in https://github.com/elsa-workflows/elsa-core/discussions/5707

Originally posted by **gustavoaraujocardozo** July 4, 2024 I have setting the project to run with mongo db, like this... elsa.UseMongoDb($"{mongoDbConnectionString}/{mongoDbName}"); elsa.UseWorkflowManagement(management => { management.UseMongoDb(); }); elsa.UseWorkflowRuntime(runtime => { runtime.UseMongoDb(); }); after execute my workflow while checking the instances, i got this error System.FormatException: An error occurred while deserializing the Outputs property of class Elsa.Workflows.Runtime.Entities.ActivityExecutionRecord: An error occurred while deserializing the MemoryBlockReference property of class Elsa.Workflows.Models.Argument: Type is not supported. ---> System.FormatException: An error occurred while deserializing the MemoryBlockReference property of class Elsa.Workflows.Models.Argument: Type is not supported. ---> System.ArgumentException: Type is not supported. at System.Runtime.CompilerServices.RuntimeHelpers.GetUninitializedObject(QCallTypeHandle type, ObjectHandleOnStack retObject) at System.Runtime.CompilerServices.RuntimeHelpers.GetUninitializedObject(Type type) at MongoDB.Bson.Serialization.BsonClassMapSerializer`1.DeserializeClass(BsonDeserializationContext context) at MongoDB.Bson.Serialization.BsonClassMapSerializer`1.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args) at MongoDB.Bson.Serialization.Serializers.SerializerBase`1.MongoDB.Bson.Serialization.IBsonSerializer.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args) at MongoDB.Bson.Serialization.BsonClassMapSerializer`1.DeserializeMemberValue(BsonDeserializationContext context, BsonMemberMap memberMap) ![image](https://github.com/elsa-workflows/elsa-core/assets/11926577/bcdf5c8f-cc34-4df2-a349-282df7695b74) I got the error at this point when call this endpoint (https://localhost:7268/elsa/api/activity-executions/report) ![image](https://github.com/elsa-workflows/elsa-core/assets/11926577/def43c9b-ecce-4b91-bf97-2a4d2dd0c118) the same is not true while using sql lite, just with mongo db. The problem start when i click on executions tab. ![image](https://github.com/elsa-workflows/elsa-core/assets/11926577/0c0da361-5506-478f-bdb7-20d03fe2bd8a)
glime-ai[bot] commented 2 months ago

The error you are encountering seems to be related to a deserialization issue with MongoDB when trying to deserialize the Outputs property of the ActivityExecutionRecord class. This could be due to a mismatch between the data stored in MongoDB and the class structure expected by the deserializer, or it could be due to the use of a type that is not supported by the MongoDB driver's deserializer.

To resolve this issue, you may need to:

  1. Ensure that the class definitions are in sync with the data stored in MongoDB.
  2. Check if there are any custom serializers or converters that need to be registered with the MongoDB driver to handle the deserialization of complex types.
  3. Review the MongoDB driver documentation to see if there are any known issues or limitations with deserializing certain types.
  4. Look for any updates or patches for Elsa Workflow that might address this issue.

If you are unable to resolve the issue on your own, consider reaching out to the Elsa Workflow community or support channels for assistance. You can also report the issue on the Elsa Workflow GitHub repository if it appears to be a bug.

Since the error does not occur with SQLite, it is likely specific to the MongoDB integration. It's also worth noting that the error message indicates that the type causing the issue is not supported, so you may need to investigate how that particular type is being handled during serialization and deserialization.

Unfortunately, without access to the specific codebase and data, it's difficult to provide a more precise solution. However, the steps above should help guide you in the right direction to troubleshoot and resolve the issue.

This comment was generated by Glime.

sfmskywalker commented 2 months ago

Which version of Elsa is this? When I try the MongoDB provider on the latest 3.2.x branch (or 3.2 preview builds), it works with no issue.

gustavoaraujocardozo commented 2 months ago

I have these packages installed

image

sfmskywalker commented 2 months ago

Can you reproduce the issue when referencing the later 3.2.x-preview packages from feedz.io?