Mayday : the set node f**ks up the workflow when having no input data

Mayday ! The set node (the “Set 3”, wich is the fourth) blocks the whole workflow when receveiving no input data from its RSS. How can I get that problem fixed ?

Mayday amazing @Jon !

You haven’t filled out the help template, and you’ve provided next to no information. Why not add the workflow JSON, or at a minimum what the Set node is configured to do…

1 Like

Hi @comedepreville,
it seems like the problem is on the Merge Node that stops the flow since it doesn’t receive one of the two inputs.

But there’s a workaround for this:

  1. Activate the setting “Always Output Data” in your RSS Nodes: this will guarantee that at least an empty object will always be returned by these Nodes.

  2. Since this will add empty objects to your data, you can then add the brand new Filter Node after the last Merge Node to pass to the following Node (Compare Node) only those items that have a non-empty field of your choice (e.g. the field “title”).

I paste an example workflow here:

(be aware the in my example I had to activate the “Always Output Data” setting in the Code Node “simulates empty output”, you should do the same in the RSS Nodes)

I hope it helps!
Please share your workflow if you need more support
Best

2 Likes

Hi @pemontto, here it is before any modification :

Hi amazing @giulioandreini, thanks a lot for all the info you provided. I activated the setting " Always Output Data" in my RSS nodes, but the same problem happened.
I share to you a screenshot of the error mentionned by the “Set” node :

Then you can also ignore errors and always output data on the set node for it to continue :wink:

Not the most optimal solution but it is a good quick fix :slight_smile:

1 Like

Hi @comedepreville ,
this happens because removeTags() expects a string and it triggers an error when there’s no title (in fact the Set Node is receiving an empty object).

You could add a bit more logic to check if title exists or not:

{{ $json.title ? $json.title.removeTags().replaceAll("'", "'").replaceAll(""", "\"") : "" }}

In this case if title is empty it will return "". This empty value is the filtered out by the Filter Node.

Here’s the full demo workflow:

Let me know if this helps!
Best

2 Likes

Huge thanks @BramKn and @giulioandreini for your answers.
I tried the first one (continue on fail), and it works perfectly. I understand that it is not the cleanest solution, but at least I can keep my workflow going.
I will try the second one to “clean” the process. I didn’t know that kind of javascript “if” expression ! Great to avoid another code node in the workflow. I will try and then come back to you.

Anyway, I will need to uprade n8n, I do not have the filter node yet :slight_smile:

2 Likes

FYI you could simplify the expression by removing the ternary condition and using optional chaining $json.title?.removeTags().

{{ $json.title?.removeTags().replaceAll("'", "'").replaceAll(""", "\"") }}

Also beware .replaceAll doesn’t work in node v14. Most n8n install should be node v16 by now, but the workaround is/was to use global regex e.g. .replace(/'/g, "'")

3 Likes

@comedepreville if you don’t have the Filter Node, you can go with the IF Node (pretty similar)
Best

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