Hello n8n community,
I am self-hosting n8n (version 1.92.2) on a Synology NAS using Docker Compose. My goal is to create a workflow that automatically processes PDF files added to a specific folder on my Synology. The workflow should:
- Use the “Watch Directory” trigger to detect new PDF files in
/volume1/knowledge_base/research_data
(which is mounted to/home/node/.n8n/research_data
in the n8n container). - Read the content of the PDF file using the “Read/Write File” node.
- Send the PDF content to a Tesseract OCR API running in another Docker container (
tesseractshadow/tesseract4re
on port 8080). - Process the OCR’d text with ChatGPT.
The “Watch Directory” trigger seems to be working intermittently (or not at all consistently). When it does trigger and the workflow proceeds to the “Read/Write File” node, I consistently encounter the following error:
Access to the file is not allowed. Error details: NodeApiError: Access to the file is not allowed.
Here’s a summary of the steps I have taken to troubleshoot this issue:
- Volume Mount: The volume mapping in my
docker-compose.yml
seems correct:`YAMLvolumes:- /volume1/docker/n8n:/home/node/.n8n
- /volume1/knowledge_base/research_data:/home/node/.n8n/research_data`
- File Permissions on Synology Host: I have extensively adjusted the permissions of the
/volume1/knowledge_base/research_data
folder and the PDF files within it on my Synology NAS. I have tried:- Granting read and write permissions to “everyone” (
chmod -R a+rw
). - Changing the owner of the folder and files to the UID of the
node
user inside the n8n container (UID 1000) and theusers
group (GID 100). - Ensuring the “users” group has read permissions (
chmod -R g+r
).
- Granting read and write permissions to “everyone” (
- User Mapping in
docker-compose.yml
: I have tried explicitly mapping thenode
user inside the container to the UID and GID on the host:YAMLuser: "1000:100"
- Testing with “Execute Command” in n8n: I tried to list and read the files from within the n8n container using the “Execute Command” node with
ls -l /home/node/.n8n/research_data
andcat /home/node/.n8n/research_data/[filename].pdf
, but encountered “Permission denied” errors initially. After adjusting host permissions,ls -l
shows the files, butcat
still gives permission errors. - “Watch Directory” Trigger Behavior: The trigger sometimes doesn’t seem to detect new files. I’ve tried different polling intervals and ensured the workflow is active.
- Work-around with “Schedule Trigger” + “List Files”: As a temporary measure, I’ve implemented a workflow that uses a “Schedule Trigger” to periodically list files in the directory and process the newest one. This works, indicating that n8n can access the files, but the “Watch Directory” trigger is unreliable.
It seems there might be a specific issue related to how Docker on Synology handles volume permissions or how the “Watch Directory” trigger interacts with the Synology filesystem within the Docker container.
Has anyone else experienced similar issues with “Access denied” errors for mounted volumes in n8n running on Docker on a Synology NAS? Are there any specific configurations or work-arounds that I might be missing?
Any help or insights would be greatly appreciated!
Cheers,
Jacco