Error: Write Binary FIle

Setup:
Docker
[email protected]

in docker-compose.yml:

n8n:
  volumes:
    - ${DATA_FOLDER}/local-files:/files

image

Error:

I’m unable to figure out where i did wrong in this flow.

Kindly advise.
Thanks.

I think you are misunderstanding what is happening. So here a more detailed explanation:

So first, why you are actually adding those lines to the docker file. What you do there is that you say that the folder ${DATA_FOLDER}/local-files should be made available inside of the n8n-docker-container as/files. Both values you can change to whatever value you want.
In this case, it uses a variable and so the actual location of the folder on your host-system depends on what you have DATA_FOLDER set to. If you have it set like in the example to /root/n8n/ the full path would be /root/n8n/local-files. That was however just an example. You should set it to wherever you want the files to be saved to. So you could also do

n8n:
  volumes:
    - /home/shrey/n8n-files:/files

Now you have one folder inside of n8n that you can write to and if you do two things will happen:

  1. The files will be persisted between n8n restarts
  2. You can easily access those files on your host-machine via the folder you defined.

So now you actually have to use that folder. Meaning in the “Write Binary File” Node under “File Name” you do not write “filename.xlsx” you write “/files/filename.xlsx”.

Then it everything will work fine.

Hi @jan, thanks for your response.

I tried what you suggested:

Still, the same error :confused:

@jan, it seems to work now, after i further modified the docker-compose.yml:

n8n:
  volumes:
    - ${DATA_FOLDER}/.n8n/local-files:/files

Anything i should have differently in the initial setup, for this issue to not have come up?

Glad to hear that it works now.

The only things I can think of is that you have to make sure that this folder exists (even though normally docker automatically creates it if not) and that you can write to it.

1 Like