I’m very new to n8n and this maybe a newbie on training wheels problem. If so, please excuse my ignorance and kindly point me in the right direction.
What I’m trying to do is to create a workflow that retrieves a list of rss feeds from a google sheet, runs a workflow to fetch the items from the feed and then publish it on to MQTT via an expression template.
Trouble is that it is not succeeding in retrieving a reference to an item.json from a previous node.
ERROR: Can’t get data for expression under ‘Message’ field
To fetch the data from other nodes that this expression needs, more information is needed from the node
‘Execute Workflow’
Stack trace reads,
ExpressionError: Can’t get data for expression
at createExpressionError (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/WorkflowDataProxy.js:453:20)
at getPairedItem (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/WorkflowDataProxy.js:506:27)
at pairedItemMethod (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/WorkflowDataProxy.js:714:40)
at Object.get (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/WorkflowDataProxy.js:717:40)
at Proxy.eval (eval at _create (/usr/local/lib/node_modules/n8n/node_modules/@n8n_io/riot-tmpl/dist/tmpl.js:388:14), <anonymous>:3:568)
at Proxy.eval (eval at _create (/usr/local/lib/node_modules/n8n/node_modules/@n8n_io/riot-tmpl/dist/tmpl.js:388:14), <anonymous>:3:647)
at Object._tmpl (/usr/local/lib/node_modules/n8n/node_modules/@n8n_io/riot-tmpl/dist/tmpl.js:335:60)
at Expression.renderExpression (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Expression.js:205:25)
at Expression.resolveSimpleParameterValue (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Expression.js:184:34)
at Expression.getParameterValue (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Expression.js:273:25)
at getNodeParameter (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/NodeExecuteFunctions.js:1286:42)
at Object.getNodeParameter (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/NodeExecuteFunctions.js:1508:24)
at MqttClient.<anonymous> (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/MQTT/Mqtt.node.js:223:44)
at MqttClient.emit (node:events:525:35)
at MqttClient.emit (node:domain:489:12)
at Readable.<anonymous> (/usr/local/lib/node_modules/n8n/node_modules/mqtt/lib/client.js:1570:14)
at Readable.emit (node:events:513:28)
at Readable.emit (node:domain:489:12)
at endReadableNT (/usr/local/lib/node_modules/n8n/node_modules/mqtt/node_modules/readable-stream/lib/_stream_readable.js:1003:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Hi @kheerand, I am sorry you are having trouble. I gave this a go on my side but didn’t run into any problem here when running your workflow on [email protected]:
This is of course with my own sheet and sub-workflow which would be different from yours.
In general, an error message such as “To fetch the data from other nodes that this expression needs, more information is needed from the node ‘Execute Workflow’” would be shown when using an expression relying on linked items, but your example expression does not seem to do this.
Are you also running into this problem when removing the "{{ $('Google Sheets').params["documentId"]["value"] }} part of your expression temporarily (so only use the simple $json... expressions instead?
Thanks for confirming @kheerand! Seeing this expression is causing the problem for you, perhaps you want to use a Set node immediately after the Google Sheets node (and thus before the Execute Workflow node) that adds a new field with your sheet ID?
Assuming none of the nodes in your workflow overwrite or remove this field you could then simply reference it using an expression like {{ $json.sheet_id }} which hopefully won’t cause any trouble:
Tried that but no luck. However, it seems that the issue is related to Execute Workflow node. I rewired the MQTT node directly out of the Switch node, and it works fine. Is it that Execute Workflow node doesn’t pass through the details of the previous nodes, or looses it somehow when executing the other workflow?
Hi @kheerand, there is indeed a good chance the Execute Workflow node doesn’t fully support paired/linked items due to its nature of essentially wrapping an unknown other workflow.
However from looking at your workflow it seems you are still using an expression other than $json in your MQTT node. What happens if you use the the workflow I’ve suggested, replacing
on your MQTT node, and instead use your {{ $('Google Sheets').params["documentId"]["value"] }} expression on the Set node before the Execute Workflow node?
This way, n8n would only read data coming directly from the Execute Workflow node, and nothing from before this node. Are you still seeing the same problem?
I tried the code you suggested, but the $json object didn’t have the sheet_id when it got to the MQTT node. This was of course handled more gracefully and instead of failing, simply passed on a empty value.
I’ve worked around this by wiring a merge node from Google sheet node, Execute workflow node and then passing it on to the MQTT node.
I’ve got a workaround now, so its good, but it does feel quite inelegant.
Hi @kheerand, the Merge node would have been the second approach. I know it’s not particularly elegant but it’s quite common (I actually suggested it just last week in a different context). So personally I am still rooting for a “Also keep incoming data” option on our nodes.
Either way, I am glad to hear you found a working approach now
Yeah, nothing wrong with using the merge node, that’s what would have to happen behind the scene anyway to ‘also keep incoming data’, but yeah, looks inelegent.