Expression file path for write binary not working

Describe the problem/error/question

I am trying to write some files to a path using an expression. Its not too complicated, but pretty odd.

The path in the UI is /tmp/dfp-backup/prod/n8n/10.json but the path in the error shows it missing the /tmp/dfp-backup/.

What is the error message (if any)?

ERROR: ENOENT: no such file or directory

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 0.228.1
  • Database (default: SQLite): postgres
  • n8n EXECUTIONS_PROCESS setting (default: own, main): queue
  • Running n8n via (Docker, npm, n8n cloud, desktop app): docker (ecs)
  • Operating system:

Hey @roemhildtg,

The expression looks a bit odd to me, have you tried $('nodename').item.json.x to see if that works

1 Like

Yes, what @jon wrote is the correct answer. The old kind of expression $node did always reference by looking for the same index. Meaning the expression worked for the first item, but as multiple workflows will be returned, will it fail for the second and all further ones. That will the resolve to undefined and so the first part of the path will be lost and so fail as the path is then invalid.

1 Like

Ohhh, duh. I remember now, it has to do with the multiple iterations. Since the config node only has one item, it only works on the first item fetched from n8n. Cheers!


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