Giter Site home page Giter Site logo

Comments (3)

glime-ai avatar glime-ai commented on June 17, 2024

Based on the context provided, it seems that you are encountering an issue where the output of a workflow used as an activity within another workflow is being treated as a string instead of an object. This issue is likely due to the way the output is being serialized or deserialized when passed between workflows.

To address this issue, you can use the workaround you mentioned, which involves setting the output of the activity to JSON and then using a SetVariable activity to parse the JSON string back into an object. Here's a step-by-step guide on how to implement the workaround:

  1. Ensure that the first workflow has an output defined as an object and that it is set to be usable as an activity.
  2. In the first workflow, create dummy data as JSON and use JSON.parse() to ensure the output is an object.
  3. In the second workflow, add the first workflow as an activity.
  4. Set the output of this activity to a variable, but instead of setting it as an object, set it as JSON.
  5. After the activity, add a SetVariable activity.
  6. Configure the SetVariable activity to set a new variable of type object with the parsed output from the activity using the expression JSON.parse(getMyOutputFromMyActivity());.
  7. Use the new object variable as needed in the rest of your workflow.

By parsing the JSON string into an object, you should be able to access its properties and use it as an object within your second workflow.

Please note that this is a workaround, and ideally, the system should handle the serialization and deserialization of objects correctly without the need for manual parsing. It might be worth reporting this issue to the Elsa Workflow GitHub repository or checking if there is an existing issue or update that addresses this behavior.

from elsa-core.

Nekrosis1 avatar Nekrosis1 commented on June 17, 2024

I tried to create a Workflow where I isolate the issue.
In that workflow, everything behaves as expected, the variable is of type object.
So the issue is not consistent or not where I assumed to be.
I added the workflow where the bug happens, which seems to do exactly the same thing as the example.

Is it possible that the variable somehow remembers that it once got a string, and then always converts its value to string, even when set to type object?

from elsa-core.

sfmskywalker avatar sfmskywalker commented on June 17, 2024

Hi @Nekrosis1 , thank you for reporting this issue. When trying to reproduce the issue, I imported your workflows, but they contain references to custom activities:

image

Is there any chance you can reproduce the behavior without using custom activities?

from elsa-core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.