Hi everyone,
I’ve been working with n8n lately and trying to build a workflow to send conversions to Facebook CAPI. The workflow is triggered by a webhook node that is connected to a form in Elementor. The data from the first step looks like this:
The second node is a SET node, as I need to filter the data I need to hash in order to send it all to Facebook. After the SET node, the data looks like this:
Now, I need to transform that item into 8 different items in order to hash them with the crypto node. So, I set up a third node, a Code node. I’m not very familiar with JavaScript, but I’ve been watching some videos from @harshil1712 on YouTube where he explains how data is structured inside n8n.
Based on those videos, the code I’m using inside the Code node is:
return items[0].json.results.map(item => ({json: item}));
But I keep getting the same error over and over:
ERROR: Cannot read properties of undefined (reading ‘map’) [Line 1]
Can anyone help me debug this script? I might be misspelling something, or maybe the code is not appropriate to separate the item into multiple items.
here’s a screenshot of the workflow so far…
Any thoughts?
Thanks in advance.
## Share the output returned by the last node
## Information on your n8n setup
- **n8n version: 0.214.3
- **Running n8n via Docker