Reading multiple inputs in Custom n8n Node not working

Info Upfront

Hi there. I decided to build a little For-Loop-Node with 3 Inputs and 3 Outputs:
Inputs:

  • Parameters (Input just to get the Loop started. Content irrelevant)
  • DataIn (Input that shall be passed through to DataOut)
  • CounterIn (Input that includes the current counter)

Outputs:

  • Finished: Shall be called with all DataIn when Loop finished
  • CounterOut: Outputs the current counter value. Is connected with CounterIn via a NoOperation
  • DataOut: Is connected with DataIn via a Code Node

What is the problem?

It looks like only one of the inputs gets filled everytime. I compared with the compare-dataset and the merge node code and don’t see any requirement to “do something” to wait for all inputs to be available.
When adding a Wait-Operation, it’s visible that the node seems to wait for inputs, but the data is not filled.

Is there anything I should check or keep in mind to fix this issue?

What is the error message (if any)?

Not a real error message, but I can share the Logs:

Counter: []
Parameters: [{"json":{"Type":"Word","Value":"Hello World"},"pairedItem":{"item":0}},{"json":{"Type":"Number","Value":"5"},"pairedItem":{"item":1}},{"json":{"Type":"Number","Value":"8"},"pairedItem":{"item":2}}]
Data: []
Looping....
CurrentValue: 1
StartValue: 1
EndValue: 10
stepValue:1
Counter: [{"json":{"counter":1},"pairedItem":{"item":0,"input":2}}]
Parameters: []
Data: []
Looping....
CurrentValue: 2
StartValue: 1
EndValue: 10
stepValue:1
... I removed some lines here...
Counter: [{"json":{"counter":9},"pairedItem":{"item":0,"input":2}}]
Parameters: []
Data: []
For Loop finished!
CurrentValue: 10
StartValue: 1
EndValue: 10
stepValue:1
2023-12-30T19:35:30.

Please share your workflow

As mentioned, it includes my CustomNode; so, not sure if you can see it

Here’s a screenshot for completeness

Information on your n8n setup

  • n8n version: 1.20.0
  • Database (default: SQLite): Postgres
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Linux (Debian or Ubuntu, not sure right now)

Not sure I understand the problem and what you want to do is even possible but anyway. Did you set requiredInputs accordingly? With it, you can define when the node should be executed. If for example any one or two inputs have to be present or if specific inputs have to contain data. You can check it in the Merge-Node.

1 Like

Hi @jan , sorry for the late response. The requiredInputs helped and I was able to some nodes yesterday (see GitHub - dev4Agriculture/n8n-nodes-advanced-flow-blocks: This repository extends some existing flow blocks within n8n to allow statistics and ensure that flows continue).

Thank you very much for this awesome piece of software :slight_smile:

2 Likes

That is great to hear, and thanks a lot for sharing your nodes with the community! I have to give them a try.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.