n8n-io / n8n-docs

Documentation for n8n, a fair-code licensed automation tool with a free community edition and powerful enterprise options. Build AI functionality into your workflows.
https://docs.n8n.io
Other
153 stars 295 forks source link

No path back to referenced node There is no connection back to the node 'CodeB', but it's used in code here. #2027

Open classbasics opened 5 months ago

classbasics commented 5 months ago

I can't seem to fix the error 'No path back to referenced node There is no connection back to the node 'CodeB', but it's used in code here. ' I have looked at https://docs.n8n.io/data/data-mapping/data-mapping-ui/ https://docs.n8n.io/data/data-mapping/data-item-linking/item-linking-errors/ and https://docs.n8n.io/data/data-mapping/data-item-linking/item-linking-code-node/#paireditem-usage-example without luck.

I have tried multiple variations.

This is my example workflow https://github.com/classbasics/intro-to-github/blob/master/My_workflow_7.json

classbasics commented 5 months ago

I just tried a different approach based on https://docs.n8n.io/data/data-mapping/data-item-linking/item-linking-node-building/ but it failed as well.

My example does not include "item": item.pairedItem as item.pairedItem is undefined or "item": i, as i is undefined

https://github.com/classbasics/intro-to-github/blob/master/My_workflow_7b.json

StarfallProjects commented 5 months ago

Hi @classbasics does this relate to a workflow example in the docs? If you need help with your own workflows, please use the forum: https://community.n8n.io/

classbasics commented 5 months ago

Yes, the docs are unclear, and seemingly contradictory. I just made two examples, based on the two processes shown in the doc, both of which did not work. It would be nice to have links to basic workflow.json files in the docs that show working examples.

On Mon, Apr 15, 2024 at 6:12 PM Deborah @.***> wrote:

Hi @classbasics https://github.com/classbasics does this relate to a workflow example in the docs? If you need help with your own workflows, please use the forum: https://community.n8n.io/

— Reply to this email directly, view it on GitHub https://github.com/n8n-io/n8n-docs/issues/2027#issuecomment-2056083326, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXNY5VJQF7RIQEGRMDS7F3Y5ODWPAVCNFSM6AAAAABGDRPCZCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJWGA4DGMZSGY . You are receiving this because you were mentioned.Message ID: @.***>

StarfallProjects commented 5 months ago

Hi @classbasics I think there are a few things going on here. First up, I've got a version of your example working, so hopefully that unblocks you. But I do think there may be some odd behaviour as well. Details of both below:

Working examples

First: I want to make sure in case there's confusion: you usually don't need to handle item pairing yourself. In the case of your simplified examples, the item pairing/item linking does nothing.

Second: Given this data structure in the Code node output:

[
  {
    "fn": "Bob",
    "age": 17
  },
  {
    "fn": "Jane",
    "age": 18
  }
]

You can refer to the fields more simply, with just $json["fn"]

So, using your first example workflow, this works: image

This simplified example also works (check the simpler data structure in the code node): compare_datasets_gh.json

So, if these examples reflect what you're trying to do, hopefully that solves the immediate problem.

Odd error

However, I do think there is also something odd going on. Although you don't need the data structure you create in the code node, and there are shorter ways of referring to input items, your way should still work (and indeed it does - for input A). I played around a little with your first example (e.g. simplifying the data) and that expression for referencing it still failed. I'm going to take this to our support team.

StarfallProjects commented 5 months ago

Worth adding: you would usually use the compare datasets node to compare by field name, so wouldn't use an expression here. But I'm guessing this was just for the sake of example?