n8n icon indicating copy to clipboard operation
n8n copied to clipboard

504 Gateway Timeout

Open suneetk92 opened this issue 1 year ago • 13 comments

Bug Description

Webhook + Respond to Webhook is resulting in 504 Gateway Timeout with the latest n8n version 1.57.0

The same workflow is working fine in 1.56.2

To Reproduce

{
  "meta": {
    "instanceId": "3bbb5eb527440d285b702982482fddd9fbd528aa6711cb410dfb9d10eb9f60cc"
  },
  "nodes": [
    {
      "parameters": {
        "respondWith": "json",
        "options": {
          "responseCode": 200
        }
      },
      "id": "28658438-e29c-499a-94af-f04e0403fefa",
      "name": "Respond to Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        820,
        860
      ]
    },
    {
      "parameters": {
        "path": "7b30ca2d-db12-43e5-88dd-1145363c148f",
        "responseMode": "responseNode",
        "options": {}
      },
      "id": "2395cdf7-6a62-4a0a-bd52-56cf3b2fb41f",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        600,
        860
      ],
      "webhookId": "7b30ca2d-db12-43e5-88dd-1145363c148f"
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {}
}

Expected behavior

Webhook + Respond to Webhook should work same as in 1.56.2

Operating System

Alpine Linux v3.20.1 (docker)

n8n Version

1.57.0

Node.js Version

v20.15.0

Database

PostgreSQL

Execution mode

queue

suneetk92 avatar Sep 07 '24 22:09 suneetk92

Hey @suneetk92,

We have created an internal ticket to look into this which we will be tracking as "GHC-212"

Joffcom avatar Sep 07 '24 22:09 Joffcom

Same here ... using Docker, n8n in queue mode ...

The nodes work, the webhook receives the data, the node responds to the webhook and executes but is not responded to by the request until it times out.

No error is generated, and the execution history shows that it was executed successfully.

luizeof avatar Sep 08 '24 19:09 luizeof

Same here ... using Docker, n8n in queue mode ...

The nodes work, the webhook receives the data, the node responds to the webhook and executes but is not responded to by the request until it times out.

No error is generated, and the execution history shows that it was executed successfully.

Exactly the same. I also have n8n in queue mode. Just for testing, running the same version in normal mode is running fine.

suneetk92 avatar Sep 08 '24 21:09 suneetk92

image

The webhook adds the task to the queue in Redis, the Worker picks up the task, executes it, and successfully saves it to the database. Meanwhile, the Webhook remains in an endless search for the response in the database.

felipeslo avatar Sep 09 '24 01:09 felipeslo

I am facing the same issue too. The workaround I found is set the Webhook to respond on Last Node Finishes and place an Aggregate node as the last node in order to wrap up the list content received for it in a single response attribute (Data for example).

LeoPQDT avatar Sep 09 '24 01:09 LeoPQDT

The same issue exists in version 1.58.1

coroschina avatar Sep 09 '24 07:09 coroschina

I also have the same problem.

easydigi avatar Sep 09 '24 07:09 easydigi

The example workflow is working fine for me in 1.58.1.

@coroschina @easydigi @LeoPQDT @luizeof can you all try the test workflow provided in 1.58.1 and see if you have the same issue.

My test was with Postgres DB and 4 workers.

Joffcom avatar Sep 09 '24 14:09 Joffcom

It's the same issue with 1.58.1.

All versions after 1.57.0 are affected.

I also have postgresDB with 3 workers and 3 webhooks

suneetk92 avatar Sep 09 '24 15:09 suneetk92

The example workflow is working fine for me in 1.58.1.

@coroschina @easydigi @LeoPQDT @luizeof can you all try the test workflow provided in 1.58.1 and see if you have the same issue.

My test was with Postgres DB and 4 workers.

Hi Man, I'm running N8N in 1.58.1 and the same issue keep alive.

LeoPQDT avatar Sep 09 '24 16:09 LeoPQDT

The example workflow is working fine for me in 1.58.1.

@coroschina @easydigi @LeoPQDT @luizeof can you all try the test workflow provided in 1.58.1 and see if you have the same issue.

My test was with Postgres DB and 4 workers.

I am experiencing this problem under version 1.58.1.

n8n:1.58.1 + postgresDB + 2 x workers + 2 x webhooks

easydigi avatar Sep 10 '24 03:09 easydigi

Are you all using webhook workers?

Joffcom avatar Sep 10 '24 07:09 Joffcom

+1

lucianodltec avatar Sep 10 '24 13:09 lucianodltec

+1

adrian-martinez-onestic avatar Sep 11 '24 12:09 adrian-martinez-onestic

Vocês todos estão usando webhook workers?

yes

felipeslo avatar Sep 11 '24 17:09 felipeslo

I also have the same problem.

guibarbas avatar Sep 11 '24 18:09 guibarbas

I also have the same problem.

bahoan avatar Sep 12 '24 03:09 bahoan

Can anyone with the issue please try this image to confirm the fix?

https://hub.docker.com/layers/n8nio/n8n/PR-10781-restore-queue-listeners-for-webhook-process/images/sha256-7afb760b0415b92abec7e20d318ff39f33b6701d7710bb5fdf6de8445c79f409

ivov avatar Sep 12 '24 10:09 ivov

With my setup, I can replicate the issue for n8n versions >= 1.57.0, and using suggested image in the same setup fixes the issue.

adrian-martinez-onestic avatar Sep 12 '24 10:09 adrian-martinez-onestic