Nodes with "Always Output Data" inside a loop firing in the wrong order

Hi,

I have a problem with a workflow, where I have a loop and some nodes that query mongodb, it works perfectly, but when I link the last node back to loop is where starts the problems. The nodes that is marked to “Always Output Data” fires without being fired by previous node, as seen in the image bellow:

The green lines is what was executed, what doesn’t make sense.

If I remove the back to loop, it works properly
As seen in image bellow

I appreciate any help,

Thanks,

Murilo Faria

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hi @Murilo_Faria,

What is the output of the nodes that execute out of order? The ones with “Always output Data”
Plus, do you get any errors or is the execution logged as running successfully?

Trying to recriate the issue, but haven’t managed to hit the same bumps so far.

Hi @mariana-na,

The output is the document from my mongodb, when it’s execute successfully, but, when it execute out of order, it returns an empty json, the mongodb operation is not executed, only returns the empty data.
I didn’t get any errors on log when execute it succesfully.

Thanks for the additional info! :raised_hands:

But do you get any error message when the execution fails?
If you are self-hosting, I suggest setting up some logging variables, if you haven’t already, to get a better glimpse at the error. Logs environment variables | n8n Docs

Could you also share your system information?

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:
  • **n8n version: ** 1.42.1
  • **Database (default: SQLite): ** Postgres
  • **n8n EXECUTIONS_PROCESS setting (default: own, main): ** main
  • **Running n8n via (Docker, npm, n8n cloud, desktop app): ** Docker
  • **Operating system: **

I got an error because it fires in the wrong order, causing it to run without the prerequisites met

@mariana-na,

I solved it as follows, I create my own custom node for mongodb that returns empty json if not found any documents, then I can turnoff the “Always Output Data” from the mongodb nodes. It works propertly inside a loop now

1 Like

HI @Murilo_Faria ,

Thanks for sharing the solution you found!
Are we ok to mark this as solution so other users that might be facing the same issue can find the answer more easily?

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