Locally hosted file retrevial

Describe the problem/error/question

I just started using n8n and planned on doing a little test project by automating a countdown of days until a certain date and then send these messages to a discord server. Catch is, to be fancy, the text will be ASCII art of bubble letters of the number of days left. The ascii is stored as a png. I have it set so i will check the number of days to dynamically find the right file name for the given day. However, when I retrieve the file (stored locally on my pc), it doesn’t return anything. Putting the path straight to the embed in the discord node just return the error below. I’m not a docker or n8n expert my any means, so I could definitely be doing something very wrong but simple and no know it. thanks in advance.

What is the error message (if any)?

n8n version

1.105.4 (Self Hosted)

Stack trace

n8n version

1.105.4 (Self Hosted)

Stack trace

TypeError: Cannot read properties of undefined (reading 'error') at ExecuteContext.parseDiscordError (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@aws-sdk+credential-providers@3.808.0_asn1.js@5_1af219c3f47f2a1223ec4ccec249a974/node_modules/n8n-nodes-base/nodes/Discord/v2/helpers/utils.ts:32:30) at ExecuteContext.execute (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@aws-sdk+credential-providers@3.808.0_asn1.js@5_1af219c3f47f2a1223ec4ccec249a974/node_modules/n8n-nodes-base/nodes/Discord/v2/actions/webhook/sendLegacy.operation.ts:153:34) at processTicksAndRejections (node:internal/process/task_queues:105:5) at ExecuteContext.router (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@aws-sdk+credential-providers@3.808.0_asn1.js@5_1af219c3f47f2a1223ec4ccec249a974/node_modules/n8n-nodes-base/nodes/Discord/v2/actions/router.ts:70:17) at ExecuteContext.execute (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@aws-sdk+credential-providers@3.808.0_asn1.js@5_1af219c3f47f2a1223ec4ccec249a974/node_modules/n8n-nodes-base/nodes/Discord/v2/DiscordV2.node.ts:33:10) at WorkflowExecute.runNode (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@opentelemetry+api@1.9.0_@opentelemetry+sdk-trace-base@1.29_46e522f8a77ed5eccc0991bfcca21502/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1212:9) at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@opentelemetry+api@1.9.0_@opentelemetry+sdk-trace-base@1.29_46e522f8a77ed5eccc0991bfcca21502/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1582:27 at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@opentelemetry+api@1.9.0_@opentelemetry+sdk-trace-base@1.29_46e522f8a77ed5eccc0991bfcca21502/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:2158:11

Please share your workflow

Share the output returned by the last node

No output data returned

Information on your n8n setup

  • n8n version: 1.105.4
  • Database (default: SQLite): default (I think)
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default (I think again, sorry)
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Ubuntu 24.04.2 LTS
  1. the Code. Consider using this slightly simplified code instead:
const targetDate = DateTime.fromISO("2025-10-30");
const daysLeft = Math.floor(targetDate.diff($now, 'days').days);

return [{ json: { daysLeft: daysLeft, file: `${daysLeft}.png` } }];
  1. re: not being able to retrieve the file: where are these files located? I bet they are on your host machine and not in the docker container, are they?

Oh thank you with the code, that’s useful!

And yes that does sound about right… they’re just simply on my machine, how do I go about getting them in the docker container?

The easiest way to get data into your container is to mount a folder from your local host machine. This will basically result in having the same folder inside the container in the location of your choosing. How do you start your n8n in docker? Via run command or through docker compose?

I, for instance, use docker compose, and here is how I mount a local folder in the service definition:

    volumes:
      - n8n_storage:/home/node/.n8n // this is unrelated to your question
      - ./shared:/data/shared // this is what creates a folder inside the 
                              // container with the content from the local
                              // folder "shared".

Then I can use /data/shared path in n8n to reach these files.

You could also host these files in the cloud, like in Google Drive and load them, which could be an easier than dealing with docker mounts. Just as an option.

Oh, cool do it would be shared. I used the command line to set up a docker compose file.

I’ve updated the last post with an example from my docker-compose

Oh ok, I recall looking at this and then forgetting about it (obviously shouldn’t have) and there wasn’t a shared one listed so I’d have to crest that then yes?

And by crest I mean create!

correct, you would have to create the folder locally (not in docker container)

Ok, and then i can tell docker somehow to make it a shared folder

correct, you tell the docker about this shared folder through a volumes entry in the service definition for your n8n service in docker-compose file

Awesome, thank you so much, sorry cause that was probably all pretty simple stuff!

It’s all good, @Chydog glad I could help.

Hello, follow up question, I have a shared volume set up, but to pull something from it, would I give n8n my local file path, or the file path within the docker?

Edit: Figured out, must give it the path within the docker container!

Scratch that I do have a follow up question, I see the data from the image and I can click view to see the image, but I can’t drag and drop to use the image as an embed on the discord node. I can drag and drop the picture when I click view which returns:

{
ā€œerrorMessageā€: ā€œCannot read properties of undefined (reading ā€˜error’)ā€,
ā€œerrorDetailsā€: {},
ā€œn8nDetailsā€: {
ā€œn8nVersionā€: ā€œ1.105.4 (Self Hosted)ā€,
ā€œbinaryDataModeā€: ā€œdefaultā€,
ā€œstackTraceā€: [
ā€œTypeError: Cannot read properties of undefined (reading ā€˜error’)ā€,
" at ExecuteContext.parseDiscordError (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@aws-sdk+credential-providers@3.808.0_asn1.js@5_1af219c3f47f2a1223ec4ccec249a974/node_modules/n8n-nodes-base/nodes/Discord/v2/helpers/utils.ts:32:30)ā€œ,
" at ExecuteContext.execute (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@aws-sdk+credential-providers@3.808.0_asn1.js@5_1af219c3f47f2a1223ec4ccec249a974/node_modules/n8n-nodes-base/nodes/Discord/v2/actions/webhook/sendLegacy.operation.ts:153:34)ā€,
" at processTicksAndRejections (node:internal/process/task_queues:105:5)ā€œ,
" at ExecuteContext.router (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@aws-sdk+credential-providers@3.808.0_asn1.js@5_1af219c3f47f2a1223ec4ccec249a974/node_modules/n8n-nodes-base/nodes/Discord/v2/actions/router.ts:70:17)ā€,
" at ExecuteContext.execute (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@aws-sdk+credential-providers@3.808.0_asn1.js@5_1af219c3f47f2a1223ec4ccec249a974/node_modules/n8n-nodes-base/nodes/Discord/v2/DiscordV2.node.ts:33:10)ā€œ,
" at WorkflowExecute.runNode (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@opentelemetry+api@1.9.0_@opentelemetry+sdk-trace-base@1.29_46e522f8a77ed5eccc0991bfcca21502/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1212:9)ā€,
" at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@opentelemetry+api@1.9.0_@opentelemetry+sdk-trace-base@1.29_46e522f8a77ed5eccc0991bfcca21502/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1582:27",
" at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@opentelemetry+api@1.9.0_@opentelemetry+sdk-trace-base@1.29_46e522f8a77ed5eccc0991bfcca21502/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:2158:11"
]
}
}

If i directly put the file path and skip the read/write node all together, I get this:

{
ā€œerrorMessageā€: ā€œCannot read properties of undefined (reading ā€˜error’)ā€,
ā€œerrorDetailsā€: {},
ā€œn8nDetailsā€: {
ā€œn8nVersionā€: ā€œ1.105.4 (Self Hosted)ā€,
ā€œbinaryDataModeā€: ā€œdefaultā€,
ā€œstackTraceā€: [
ā€œTypeError: Cannot read properties of undefined (reading ā€˜error’)ā€,
" at ExecuteContext.parseDiscordError (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@aws-sdk+credential-providers@3.808.0_asn1.js@5_1af219c3f47f2a1223ec4ccec249a974/node_modules/n8n-nodes-base/nodes/Discord/v2/helpers/utils.ts:32:30)ā€œ,
" at ExecuteContext.execute (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@aws-sdk+credential-providers@3.808.0_asn1.js@5_1af219c3f47f2a1223ec4ccec249a974/node_modules/n8n-nodes-base/nodes/Discord/v2/actions/webhook/sendLegacy.operation.ts:153:34)ā€,
" at processTicksAndRejections (node:internal/process/task_queues:105:5)ā€œ,
" at ExecuteContext.router (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@aws-sdk+credential-providers@3.808.0_asn1.js@5_1af219c3f47f2a1223ec4ccec249a974/node_modules/n8n-nodes-base/nodes/Discord/v2/actions/router.ts:70:17)ā€,
" at ExecuteContext.execute (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@aws-sdk+credential-providers@3.808.0_asn1.js@5_1af219c3f47f2a1223ec4ccec249a974/node_modules/n8n-nodes-base/nodes/Discord/v2/DiscordV2.node.ts:33:10)ā€œ,
" at WorkflowExecute.runNode (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@opentelemetry+api@1.9.0_@opentelemetry+sdk-trace-base@1.29_46e522f8a77ed5eccc0991bfcca21502/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1212:9)ā€,
" at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@opentelemetry+api@1.9.0_@opentelemetry+sdk-trace-base@1.29_46e522f8a77ed5eccc0991bfcca21502/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1582:27",
" at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@opentelemetry+api@1.9.0_@opentelemetry+sdk-trace-base@1.29_46e522f8a77ed5eccc0991bfcca21502/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:2158:11"
]
}
}

Looking quickly, I believe these are both the same errors.

I think I’ve seen this question asked in the forum before. Try to click on search idon and search for

Cannot read properties of undefined discord

I looked it up, but didn’t see much that applied, someone has a somewhat similar issue and they said to try using the v1 discord node, but not sure how to find that…