Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Respond to callback not working when using wait node option “On webhook call” #13633

Open
brunolnetto opened this issue Mar 3, 2025 · 6 comments
Labels
in linear Issue or PR has been created in Linear for internal review In Review We are reviewing the issue

Comments

@brunolnetto
Copy link

brunolnetto commented Mar 3, 2025

Bug Description

Describe the problem/error/question

I try to perform an action where I trigger a workflow and wait it to callback the main execution back. It works, partially, and I am getting trouble to make the Webhook respond properly. When I set the main workflow to "Respond to Webhook", it does not respond to the FORMER HTTP Request. I am almost sure, the reason for the webhook not responding anymore is because I activate the "wait node" with option "On webhook call", a bug in my opinion: Even though I set it as "Respond immediately", other webhook calls just get "overlooked" or "overwritten" somehow...

I manage to design this minimal example below. For some unknown reason to me, it works in test mode, but not in production mode.
/

Please share your workflow

{
  "nodes": [
    {
      "parameters": {
        "options": {}
      },
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        460,
        -20
      ],
      "id": "5efeac47-1b2b-43e5-aed9-738dada7458d",
      "name": "Respond to Webhook"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "b2c3bf80-5130-4da6-906f-d512a57eac13",
              "name": "webhook_url",
              "value": "={{ $('Entrypoint').item.json.webhookUrl.split('/').slice(0, 3).join('/') }}",
              "type": "string"
            },
            {
              "id": "e16769b3-fa71-4031-ba02-a18901b4be32",
              "name": "webhook_route",
              "value": "={{ '/' + $('Entrypoint').item.json.webhookUrl.split('/').slice(4).join('/') }}",
              "type": "string"
            },
            {
              "id": "5f024754-2abf-4ea6-a732-157dfa18ec91",
              "name": "callback_url",
              "value": "={{ $execution.resumeUrl }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -180,
        -20
      ],
      "id": "6e2e4583-824c-433f-9aa0-835741dff702",
      "name": "Necessary data"
    },
    {
      "parameters": {
        "path": "debug",
        "responseMode": "responseNode",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        -400,
        -20
      ],
      "id": "9ea17d4f-92cd-4516-8b53-090e9516bdfb",
      "name": "Entrypoint",
      "webhookId": "a58f14f5-b010-4aef-9610-4490d26ec403"
    },
    {
      "parameters": {
        "resume": "webhook",
        "options": {}
      },
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        240,
        -20
      ],
      "id": "48ee70e9-c5df-4401-b663-07b3aa669d0c",
      "name": "Wait",
      "webhookId": "fd9880b7-1cd7-4542-8e2f-665811832f9c"
    },
    {
      "parameters": {
        "inputSource": "passthrough"
      },
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "typeVersion": 1.1,
      "position": [
        -400,
        200
      ],
      "id": "bbfb4575-90ca-43c3-99e7-166b2762fa39",
      "name": "When Executed by Another Workflow"
    },
    {
      "parameters": {
        "workflowId": {
          "__rl": true,
          "value": "={{ $workflow.id }}",
          "mode": "id"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {},
          "matchingColumns": [],
          "schema": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        },
        "options": {
          "waitForSubWorkflow": false
        }
      },
      "type": "n8n-nodes-base.executeWorkflow",
      "typeVersion": 1.2,
      "position": [
        20,
        -20
      ],
      "id": "596d28ae-4241-4431-9ca2-e416b807dc57",
      "name": "Execute Workflow"
    },
    {
      "parameters": {
        "amount": 1
      },
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        -180,
        200
      ],
      "id": "4b2eba23-b0ee-4f04-b826-9f2fa7550382",
      "name": "Wait1",
      "webhookId": "26a0e30a-ebb5-40ee-87f4-42981ab6b898"
    },
    {
      "parameters": {
        "url": "={{ $('When Executed by Another Workflow').item.json.callback_url }}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        40,
        200
      ],
      "id": "398d5248-92f8-4f43-813c-6f9396a8bc71",
      "name": "HTTP Request"
    }
  ],
  "connections": {
    "Respond to Webhook": {
      "main": [
        []
      ]
    },
    "Necessary data": {
      "main": [
        [
          {
            "node": "Execute Workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Entrypoint": {
      "main": [
        [
          {
            "node": "Necessary data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "Wait1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute Workflow": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait1": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "meta": {
    "instanceId": "2e4f8121945025cdf9238c79aefe23511c144e8abb0729066dfb54ab1f405578"
  }
}

Information on your n8n setup

  • n8nVersion: 1.80.5
  • platform: docker (self-hosted)
  • nodeJsVersion: 20.18.3
  • database: postgres
  • executionMode: scaling
  • concurrency: -1
  • license: enterprise (production)

To Reproduce

  1. Copy-paste the workflow on the canvas of an empty workflow in your N8N instance;
  2. Activate the respective workflow;
  3. Save the workflow;
  4. Choose your favourite request tool. Mine is terminal curl. Then perform a GET request on the workflow;
  5. Look on executions section: you will see 2 sucessful executions after few seconds;
  6. Look back on your request tool output: it still have not succeeded.

Expected behavior

I expected to receive the result.

Operating System

Ubuntu Linux 20.04

n8n Version

1.80.5

Node.js Version

20.18.3

Database

PostgreSQL

Execution mode

queue

@Joffcom
Copy link
Member

Joffcom commented Mar 3, 2025

Hey @brunolnetto,

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

@Joffcom Joffcom added the in linear Issue or PR has been created in Linear for internal review label Mar 3, 2025
@netroy
Copy link
Member

netroy commented Mar 3, 2025

are you running multiple main instances?

@Joffcom Joffcom added the Needs Feedback Waiting for further input or clarification. label Mar 3, 2025
@brunolnetto
Copy link
Author

brunolnetto commented Mar 3, 2025

A single main instance. I added a missing clause 'Wait For Sub-Workflow Completion' on the node 'Execute Workflow'.

@Joffcom Joffcom removed the Needs Feedback Waiting for further input or clarification. label Mar 3, 2025
@Joffcom
Copy link
Member

Joffcom commented Mar 3, 2025

Hey @brunolnetto,

What seems to be happening here is the Execute workflow is waiting for the sub workflow to complete before moving on which means the wait node isn't waiting for the URL to be hit so it isn't properly listening on the resume URL.

If you update the Execute Workflow node and set Wait For Sub-Workflow Completion to False under the options it will fire off the sub workflow then move to the wait node and start listening for the request and assuming the wait is long enough the sub workflow will call the URL and everything will work.

I don't think this is a bug as I wouldn't expect the wait node to be waiting before it has started.

@Joffcom Joffcom added the Needs Feedback Waiting for further input or clarification. label Mar 3, 2025
@brunolnetto
Copy link
Author

Ops, too late. I updated the post with my further discovery, but you were faster than me. By responding immediately, it still does not work in production mode, only on test mode.

@Joffcom Joffcom removed the Needs Feedback Waiting for further input or clarification. label Mar 3, 2025
@Joffcom
Copy link
Member

Joffcom commented Mar 3, 2025

Hey @brunolnetto,

Ah yeah look like you are right, I suspect this will be linked to workflows hitting the database in a waiting state and "finishing" before the workflow has actually finished. I will pass this back to the team that looks after this area for further thought.

@Joffcom Joffcom added Needs Feedback Waiting for further input or clarification. In Review We are reviewing the issue and removed Needs Feedback Waiting for further input or clarification. labels Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in linear Issue or PR has been created in Linear for internal review In Review We are reviewing the issue
Projects
None yet
Development

No branches or pull requests

3 participants