WordPress Media API Upload: 503 Service Unavailable / ECONNABORTED on Large Files

The Problem:
I am attempting to automate full article posting to a WordPress site (Signé Magazine) using n8n. While small images (<1MB) upload successfully, high-quality images (larger file sizes) cause the HTTP Request node to fail with either a 503 Service Unavailable or an ECONNABORTED (timeout) error.
What is happening:
Despite the error in n8n, the images actually appear in the WordPress Media Library. It seems the server finishes the upload but takes too long to process thumbnails, causing the connection to drop before n8n receives the JSON response (Media ID).
What we have tried:
Increased n8n Timeout: Set the node timeout to 60s and 108s, resulting in ECONNABORTED.
Batching: Set batch size to 1 with a 10s interval.

Current Workflow Setup:

  • n8n Version: 2.6.4 (Self-Hosted)

  • Binary Mode: Filesystem

  • Node: HTTP Request (v4.4)

  • Target: WordPress REST API (/wp/v2/media)

What I need help with:

  1. How can I reliably upload high-quality images without the server timing out?
1 Like

Hi @Rohan_Gorle

start by testing this :

shrinking the file before it hits wordpress. drop an Edit Image node right before your http request. scaling the width down a bit or compressing the quality usually speeds up the upload enough that it stops timing out.

check these from n8n’s side:

  1. Increase HTTP timeout in the node significantly (e.g. up to several minutes) using the Timeout option. [HTTP timeout]

  2. Keep binary mode = filesystem, which is recommended for large files. [Handling large files]

  3. Use Batching (1 item per batch, delay between batches) and Retry On Fail to reduce load and recover from transient 503s. [Rate limits – batching; Retry on fail]

  4. If WordPress still times out:

  • Accept that the upload may complete after n8n’s timeout.

  • Implement a follow‑up HTTP Request that queries WordPress for the media item (by filename or other identifier), similar to how long‑running Apify tasks are handled via polling. [Apify timeout handling]

Anything beyond this (like changing PHP/nginx/Apache timeouts or WordPress image processing behavior) would be on the WordPress/server side.