# How to fix n8n Cloud webhook timeout (524) for long-running jobs

Gregale · Updated 2026-12-01

Keep n8n Cloud, return a 202 with a job ID, and poll for a slow Python job rather than waiting on the original webhook request.

**If a long-running n8n Cloud webhook returns 524, respond before the
work finishes.** Submit the work, return `202 Accepted` with a job ID,
and let the caller check a status URL. Keep the workflow in n8n Cloud;
only the separate Python job runs on Gregale.

[n8n documents a 100-second response limit for incoming Cloud
webhooks](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.webhook/common-issues#timeouts-on-n8n-cloud).
If the workflow can finish quickly after removing one slow step,
start there. If you can do all the work in n8n, n8n's start-and-status
pattern does not require another host. Use this example when the long
step needs its own runtime or Python dependencies.

## Send a receipt, then check the result

| Request                                                      | What it returns                                                                           |
| ------------------------------------------------------------ | ----------------------------------------------------------------------------------------- |
| `POST /webhook/gregale-pdf-batch` with a stable `request_id` | `202` and a `job_id` after the batch is recorded. It does not wait for Python to finish.  |
| `GET /webhook/gregale-pdf-batch-status?jobId=JOB_ID`         | `200` and `accepted` while waiting, then `succeeded` with the checksum and synthetic PDF. |

The first n8n Webhook forwards a short submission to FastAPI. The
second forwards a status check. Both use **Respond to Webhook** so
they can return the backend's status code. No node holds the original
connection open while the PDF is being built. Poll with backoff and
stop at a deadline rather than leaving a loop running indefinitely.

Keep the same request ID if the initial request times out or its
response is lost. A unique PostgreSQL constraint returns the original
job ID on a retry; reusing the ID with different input gets `409`.
Generate the ID in the caller and preserve it across retries. A new
random ID on every attempt does not protect you from duplicates.

## Import and try it

[Download the n8n workflow, backend, and smoke test](https://gregale.dev/examples/n8n-webhook-timeout-pdf-batch.zip).
The bundle uses two synthetic PDF pages, not uploaded files. Its
README shows how to deploy FastAPI with PostgreSQL, configure separate
credentials for n8n and the backend, and fire the Python worker
separately. The example uses a [Gregale command cron](https://gregale.dev/docs/crons.md),
a preview feature that requires app tasks. Use an eligible test app.

1. Import the workflow. Replace the example origins and select the two
   credentials. Never paste your Gregale CLI token into the workflow.
2. Submit twice with the same request ID. Confirm both responses name
   one job and the status is still pending.
3. Run the worker. Fetch the result and check that the first page says
   `SECOND BATCH PAGE`, the second `FIRST BATCH PAGE`, and the file
   matches the returned SHA-256.

A 202 only proves the job was recorded. Track jobs that stay pending
too long and report processing failures separately. For bigger files,
return a short-lived download URL instead of base64, and keep any
customer data out of execution logs.

For a short, synchronous task that only needs a Python package,
see [Use Python libraries in n8n Cloud](https://gregale.dev/articles/n8n-cloud-python-libraries-fastapi).

## What we verified

We imported the workflow into local n8n 2.49.9. It returned `202`
while the job was pending, returned the same ID on a retry, rejected
changed input under the same ID, and served the exact merged PDF
after the worker ran.

We separately ran the same backend on Gregale Scale with managed
PostgreSQL and fired a command cron. The private HTTPS endpoint
returned the same ID on retry, then served the expected two page
labels and matching SHA-256. We disabled the test cron afterwards.
We did not run the workflow in a hosted n8n Cloud workspace.

## Questions

### Why does my n8n Cloud webhook return 524?

n8n documents a 100-second response limit for incoming Cloud webhooks. Return a job ID promptly and let the caller check for the result separately.

### Does this guide host n8n on Gregale?

No. Keep the n8n workflow in n8n Cloud. Gregale runs only the separate FastAPI job service and worker.

Canonical URL: https://gregale.dev/articles/fix-n8n-cloud-webhook-timeout-524

