Issues with sending file through http request (post)

Describe the issue/error/question

When I want to send a file to appwrite server (appwrite.io) it show below error.
I want to know how can I send file to for example appwrite.

What is the error message (if any)?

Cause
Data below may contain sensitive information. Proceed with caution when sharing.
{
“status”: “rejected”,
“reason”: {
“message”: “500 - {“message”:“Server Error”,“code”:500,“type”:“general_unknown”,“version”:“0.14.2”}”,
“name”: “Error”,
“stack”: “Error: Request failed with status code 500 at createError (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/createError.js:16:15) at settle (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/settle.js:17:12) at IncomingMessage.handleStreamEnd (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/adapters/http.js:269:11) at IncomingMessage.emit (node:events:539:35) at endReadableNT (node:internal/streams/readable:1345:12) at processTicksAndRejections (node:internal/process/task_queues:83:21)”
}
}

Information on your n8n setup

  • n8n version: 0.177.0
  • Database you’re using (default: SQLite):
  • Running n8n with the execution process [own(default)]:
  • Running n8n via [Docker]:

Update:
I set http body to “JSON/RAW Parameters” and set “send binary body” true.
By these setting I think I could send file to my appwrite server.
Now my problem is that I should send “fileId” Parameter too and I don’t know how to send file data and another parameter (fileId) by http request.

hi @mooghermez

try this in the query parameters:
{“fileId”:“unique()”}

Thanks for responding
Unfortunately while I fill by that it show the same error yet:

ERROR: UNKNOWN ERROR - check the detailed error for more information
Param “fileId” is not optional.

Hi @mooghermez

I had some time to test it now.
Had some trouble but luckily the docs on the HTTP node tell the answer.

https://docs.n8n.io/integrations/core-nodes/n8n-nodes-base.httprequest/?utm_source=n8n_app&utm_medium=node_settings_modal-credential_link&utm_campaign=n8n-nodes-base.httpRequest#create-a-jsonraw-header-object

This is the same for the query params.
Resulting in this setup:
image

1 Like

Thanks for your advice @BramKnuever
Unfortunately, I have same error.
I think the problem is that http request node does not support sending file and data together.

I think we should request via new feature from admins.

This is a current limitation of the HTTP request node when sending multipart-form data. You can send binary data or JSON data but not both (like what you need to do.). The limitation will be addressed in the next version of the HTTP node. In the meantime, you can make the HTTP request from a function node where you have complete control over the request.

2 Likes