Discord Node suddenly returns error when uploading an image (binary)

I’ve been using this automation in the past without problem. The setup is as follows: HTTP node downloads an image and returns it as file (binary). I can view and download that image from the n8n workflow, which means that part still work. That image is then passed onto a discord node which sends a message and attached the image as File. Connection method is Webhook.

This is worked flawlessly before. Recently I reactivated it but now the Discord node returns following error:

The “chunk” argument must be of type string or an instance of Buffer or Uint8Array. Received type boolean (false) [item 0]

Item 0 should be the first item in the input data. However that item does have a valid image (binary data).

There is no mismatch between json data and binary data, both have the same amount of items.
The workflow works fine if I remove the “File” from the Discord node.

All I want is the message to have an image. So if there is an other method to achieve that I’m happy too. I do have an URL to the image but even when inserting that into “URL image” or “URL Thumbnail” it doesn’t show up in discord.

Hi @Utz

The most reliable way to bypass this bug and get your images back into Discord is to use the HTTP Request node to communicate with the Discord Webhook directly.

Here is exactly how to set it up:

  1. Replace the Discord Node with an HTTP Request node.
  2. Method: Set to POST.
  3. URL: Paste your Discord Webhook URL here.
  4. Authentication: None (Webhooks are authenticated by the URL itself).
  5. Send Body: Toggle this On​.
  6. Body Content Type: Select Form-Data (Multipart).
  7. Specify Body Parameters:
    • File Upload:
      • Click Add Parameter →→ select Binary File​.
      • Name: Enter file (This is the exact key Discord expects).
      • Input Data Field Name: Enter thumbdata (matching your binary property name).
    • Message/Embeds:
      • Click Add Parameter →→ select Text​.
      • Name: Enter payload_json.
      • Value: Enter the JSON for your message and embeds.
      • Example: {"content": "Here is your image!", "embeds": [{"title": "Image Title", "description": "Description here"}]}
        (You can use expressions here to pull data from your previous nodes, just ensure the final result is a valid JSON string).

Thank you but that doesn’t seem to work.

As soon as I use “Form-Data” it fails with various errors.

If I use only one parameter (“Text” is not available only Form-Data)

type: form data

name: payload_json

value: {"content":"test message"}

It results in this error:

data should be a string, Buffer or Uint8Array [item 0]

If I add the binary parameter the error changes to:

The connection to the server was closed unexpectedly, perhaps it is offline. You can retry the request immediately or wait and retry later. [item 0]

When I use type “JSON” instead I can send a simple test message, so the problem isn’t discord but N8N.

Try this

  1. Copy the JSON code above.
  2. Go to your n8n workflow canvas.
  3. Cmd+V (Mac) or Ctrl+V (Windows) to paste the nodes directly onto the canvas.
  4. Double-click the Discord Fix Code node.
  5. Find the line: const WEBHOOK_URL = 'REPLACE_WITH_YOUR_DISCORD_WEBHOOK_URL'; and paste your actual URL inside the quotes.
  6. Check the BINARY_PROPERTY line. If your binary field is named thumbdata, change 'data' to 'thumbdata'.

Solved it by updating N8N to the latest version. The discord node now works as intented and as it did in the past.