Webhook data disappears on False branches of IF and SWITCH nodes

Describe the problem/error/question

I’m running this workflow and I’ve added some logic to account for the scenario where the user already exists in the system so it will not try to create an identical user.
The problem is the data from the Webhook node is not accessible on the “false” branch of the SWITCH node:


I’ve tried it with both IF and SWITCH nodes for the routing and same thing happens on both. Why would the webhook node data be unavailable downstream of the false branch? Is that a bug or am I missing something? I’ve enabled the “Always Output Data” setting.

What is the error message (if any)?

{ "error_class": "UserError", "args": { "code": "1725300474929x681266107917233800" }, "message": "NO_EMAIL", "translation": "Please include an email" }

I made a loom video and reproduced the issue so you can see what I’m seeing:

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 1.55.3
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main): not sure
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker self-hosted
  • Operating system: Debian Linux v. 12.6

@scrollinondubs , your reference to the webhook data in “Create User” node does not look right to me. You likely need to replace {{ $('Webhook').json.body... }} with {{ $('Webhook').first().json.body... }}. Note the usage of the function first(). Please refer to Output of other nodes | n8n Docs for more details.

3 Likes

@ihortom indeed your suggestion fixed it!
I’m admittedly still confused as to why a) it worked before without needing the “first().” portion prior to me inserting the conditional logic but also b) why the Webhook data isn’t accessible in the schema view of that branch.
At any rate all’s well that ends well. Thank you so much for your assistance on this :pray:. I will keep it in mind re: the first(). modifier for these scenarios.

It could have worked if the node immediately followed the webhook node. If there is yet another node in between, it cannot work and you have to utilize one of the following expressions instead:

  • $('<node>').item.json... (using item implies automatic detection of the Item Linking)
  • $('<node>').first().json... (works when only one item in the output, you specifically tell n8n to get the 1st item)
  • $node['<node>'].item.json... (old way, usage is discouraged)

I believe it is a bug. It was reported by many. Switching to JSON or Table view still should work though.

Yes it was previously structured so that the create user node immediately followed the Webhook node. I added the conditional logic to first check whether the user already exists and route accordingly for one of the two branches. Good to know that the syntax is forgiving when it immediately follows the webhook node.

Ahh ok yes, you’re correct. It’s absent only on the Schema view but the data appears in both the Table and JSON views.

Again thanks so much for your guidance here. Was scratching my head for a long time on this one. cheers