MathisG
MathisG3w ago

Flow working during single step test, but failing when doing the whole flow execution

Hi there, I'm having a weird issue with my flow. The GetTodoistProject is getting the Inbox project from the project list. It works on the single step But when executing the whole flow, I get an error. But I have an output ! Have I missed something ?
No description
No description
No description
No description
9 Replies
MathisG
MathisGOP3w ago
@Ask Inkeep
Ask Inkeep
Ask Inkeep3w ago
Thanks for tagging me @MathisG. I'll look through relevant sources and get back to you shortly. Answer Based on your description, this sounds like a step execution issue where the individual step works but fails within the flow context. Here are the most common causes and troubleshooting steps: Check Error Handler Configuration If your flow has error handling configured, the step might be triggering an error handler even when producing output (1) . Review your flow's error handling settings to see if there's an error handler that's being invoked. Test Flow vs Test Step Differences When you test an individual step versus the entire flow, different execution contexts apply (2) . The step might be receiving different inputs when executed as part of the full flow compared to when tested individually. Verify Input Transforms Check the input_transforms configuration for your GetTodoistProject step (3) . When running the full flow, the step receives inputs from previous steps through these transforms, which might be different from the test inputs you're using for individual step testing. Debug with Test Up To Step Use the "Test up to step" feature to isolate the issue (2) . Run the flow up to your GetTodoistProject step and examine: - The actual inputs being passed to the step - Any differences in the execution environment - The exact error message and stack trace Check Step Dependencies Ensure that any previous steps in your flow are providing the expected outputs that GetTodoistProject depends on (4) . The step might be failing due to missing or malformed input data from upstream steps. API-Based Debugging Since you're a developer, you can also use Windmill's API to inspect the job execution details programmatically. Check the job logs and execution details through the API to get more granular error information. If you can share the specific error message you're seeing when running the full flow, that would help pinpoint the exact issue. ​ To learn more, see the sources I considered: [1] Error handling [2] Testing flows [3] OpenFlow Spec [4] Flows quickstart ​ Feel free to tag @Ask Inkeep with additional questions.
MathisG
MathisGOP3w ago
It seems like the javascript single step allows you to do expressions like previous_result.results.find(prj => prj.name == "Inbox").id but not the flow execution ? It's weird that it isn't stated in the doc thought @Ask Inkeep
Ask Inkeep
Ask Inkeep3w ago
Thanks for the follow-up, @MathisG. I'll get back to you soon. Answer You're correct that there's a difference in how JavaScript expressions work in individual step testing versus full flow execution. The issue you're encountering is related to how Windmill's input transforms work in flows. JavaScript Expression Context in Flows In flow execution, JavaScript expressions in input transforms operate in a restricted environment (1) . The available context includes: - flow_input: the dict/object containing the different parameters of the Flow itself - results.{id}: the result of the step with given ID
- resource(path) : the Resource at path - variable(path) : the Variable at path The Key Difference When testing individual steps, you might be using previous_result directly, but in actual flow execution, you need to reference results by step ID using the results.{id} syntax . Correct Expression Format Instead of:
previous_result.results.find(prj => prj.name == "Inbox") .id
previous_result.results.find(prj => prj.name == "Inbox") .id
You should use:
results.{your_step_id}.results.find(prj => prj.name == "Inbox") .id
results.{your_step_id}.results.find(prj => prj.name == "Inbox") .id
Where {your_step_id} is the actual ID of your previous step. Expression Evaluation Complex JavaScript expressions like yours are evaluated by an embedded V8 engine using the Deno runtime, which takes approximately 8ms per expression (2) . However, most expressions are optimized and converted directly to raw JSONB statements for better performance. API-Based Solution Since you're a developer, you can also programmatically inspect your flow's step IDs and results structure using Windmill's API to ensure your expressions reference the correct step outputs. The documentation does cover this in the input transform section, but the distinction between test context and flow execution context could be more prominent. ​ To learn more, see the sources I considered: [1] Architecture and data exchange [2] Launch Week Day 3 - Fastest self-hostable open-source workflow engine | Windmill ​ Feel free to tag @Ask Inkeep with additional questions.
MathisG
MathisGOP3w ago
results.{your_step_id}.results.find(prj => prj.name == "Inbox") .id does work for single Test this step but not for the flow : ExecutionErr: Error during isolated evaluation of expression results.van.results.find(prj => prj.name == "Inbox") .id: Uncaught SyntaxError: Unexpected token '(' at <anon>:47:32 @Ask Inkeep
Ask Inkeep
Ask Inkeep3w ago
Thanks for the follow-up, @MathisG. I'll get back to you soon. Answer The syntax error you're encountering is due to the JavaScript expression evaluation in flow execution context. Based on the documentation, there's a specific way to handle this. The Issue The error Uncaught SyntaxError: Unexpected token '(' indicates that the JavaScript expression evaluator in flow context doesn't support the same syntax as individual step testing (1) . Solution: Use Optional Chaining According to the GitHub issue documentation, the correct approach is to use optional chaining syntax. Instead of:
results.van.results.find(prj => prj.name == "Inbox") .id
results.van.results.find(prj => prj.name == "Inbox") .id
Use:
results?.van?.results?.find(prj => prj.name == "Inbox") ?.id
results?.van?.results?.find(prj => prj.name == "Inbox") ?.id
This is documented in the help section of flow input expressions (2) . Alternative Approaches You can also use conditional checks:
return results.van && results.van.results ? results.van.results.find(prj => prj.name == "Inbox") ?.id : null
return results.van && results.van.results ? results.van.results.find(prj => prj.name == "Inbox") ?.id : null
Input Transform Context The input transform mechanism maps parameters using JavaScript expressions that can reference (1) : - flow_input: the dict/object containing the different parameters of the Flow itself - results.{id}: the result of the step with given ID - resource(path) : the Resource at path
- variable(path) : the Variable at path API-Based Debugging Since you're a developer, you can also use Windmill's API to inspect the exact structure of results.van to ensure your expression matches the actual data structure being returned. The key difference is that flow execution uses a more restricted JavaScript evaluation environment compared to individual step testing, requiring safer syntax patterns like optional chaining. ​ To learn more, see the sources I considered: [1] Architecture and data exchange [2] bug: Input template from branch_one action output is always null ​ Feel free to tag @Ask Inkeep with additional questions. Got it. Tagging @rubenf for additional help.
MathisG
MathisGOP3w ago
Same error, it doesn't work any better, sorry for that. I have put the GetTodoistProjectList and GetTodooistProject outside the for loop but it isn't working
rubenf
rubenf3w ago
I would say try modifying the expression into something simpler until you do not have that error
MathisG
MathisGOP3w ago
I used an intermediate script step in the end Would you want me to add a github issue ? Maybe for adding precisions on the UI about the limitations of the flow parsing ?

Did you find this page helpful?