Trouble wtih Http Request node and binary data in a code node

Describe the problem/error/question

I am having trouble making an http request to an image and using it as binary data in a following node. For some reason the http request node says not found for many images, even though I can get successful responses in code nodes to the same image. When the request is successful, I can get an image uploaded to wordpress using an http request POST node, but I don’t know how to do an http request from a code node, and send the response as a n8n binary to an upload http request.

What is the error message (if any)?

AxiosError: Request failed with status code 404\n at settle (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/[email protected]/node_modules/axios/lib/core/settle.js:19:12)\n at RedirectableRequest.handleResponse (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/[email protected]/node_modules/axios/lib/adapters/http.js:547:9)\n at RedirectableRequest.emit (node:events:530:35)\n at RedirectableRequest._processResponse (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/[email protected]/node_modules/follow-redirects/index.js:409:10)\n at ClientRequest.RedirectableRequest._onNativeResponse (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/[email protected]/node_modules/follow-redirects/index.js:102:12)\n at Object.onceWrapper (node:events:633:26)\n at ClientRequest.emit (node:events:518:28)\n at HTTPParser.parserOnIncomingClient (node:http_client:716:27)\n at HTTPParser.parserOnHeadersComplete (node:http_common:117:17)\n at TLSSocket.socketOnData (node:http_client:558:22)\n at Axios.request (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/[email protected]/node_modules/axios/lib/core/Axios.js:45:41)\n at processTicksAndRejections (node:internal/process/task_queues:105:5)\n at invokeAxios (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@[email protected][email protected][email protected][email protected]/node_modules/n8n-core/src/execution-engine/node-execution-context/utils/request-helper-functions.ts:315:10)\n at proxyRequestToAxios (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@[email protected][email protected][email protected][email protected]/node_modules/n8n-core/src/execution-engine/node-execution-context/utils/request-helper-functions.ts:707:20)\n at Object.request (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@[email protected][email protected][email protected][email protected]/node_modules/n8n-core/src/execution-engine/node-execution-context/utils/request-helper-functions.ts:1753:4)

Please share your workflow

Share the output returned by the last node

CODE NODE OUTPUT:
[
{
“data”: “I_TRIMMED_THIS_FROM_THE_POST_BUT_IT_CLEARLY_HAD_PNG_BINARY_DATA_AS_A_STRING
},
{
“data”: “TRIMMED_FROM_POST
}
]

HTTP REQUEST ERROR OUTPUT:
[
{
“url”: “http://www.fda.gov/files/styles/recall_image_small/public/image_1_101.png”,
“error”: {
“message”: “404 - "Not found\n"”,
“name”: “AxiosError”,
“stack”: “AxiosError: Request failed with status code 404\n at settle (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/[email protected]/node_modules/axios/lib/core/settle.js:19:12)\n at RedirectableRequest.handleResponse (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/[email protected]/node_modules/axios/lib/adapters/http.js:547:9)\n at RedirectableRequest.emit (node:events:530:35)\n at RedirectableRequest._processResponse (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/[email protected]/node_modules/follow-redirects/index.js:409:10)\n at ClientRequest.RedirectableRequest._onNativeResponse (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/[email protected]/node_modules/follow-redirects/index.js:102:12)\n at Object.onceWrapper (node:events:633:26)\n at ClientRequest.emit (node:events:518:28)\n at HTTPParser.parserOnIncomingClient (node:http_client:716:27)\n at HTTPParser.parserOnHeadersComplete (node:http_common:117:17)\n at TLSSocket.socketOnData (node:http_client:558:22)\n at Axios.request (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/[email protected]/node_modules/axios/lib/core/Axios.js:45:41)\n at processTicksAndRejections (node:internal/process/task_queues:105:5)\n at invokeAxios (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@[email protected][email protected][email protected][email protected]/node_modules/n8n-core/src/execution-engine/node-execution-context/utils/request-helper-functions.ts:315:10)\n at proxyRequestToAxios (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@[email protected][email protected][email protected][email protected]/node_modules/n8n-core/src/execution-engine/node-execution-context/utils/request-helper-functions.ts:707:20)\n at Object.request (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@[email protected][email protected][email protected][email protected]/node_modules/n8n-core/src/execution-engine/node-execution-context/utils/request-helper-functions.ts:1753:4)”,
“code”: “ERR_BAD_REQUEST”,
“status”: 404
}
}
]

Information on your n8n setup

  • **n8n version: 1.100.1
  • **Database (default: SQLite): default
  • **n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • **Running n8n via (Docker, npm, n8n cloud, desktop app): kubernetes
  • **Operating system: ec2 machine in elast.io 1 gb memory 2 cpu ubuntu machine

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