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

N8N form node, freezes when clicking Next #11732

Open
easydigi opened this issue Nov 14, 2024 · 8 comments
Open

N8N form node, freezes when clicking Next #11732

easydigi opened this issue Nov 14, 2024 · 8 comments
Labels
in linear Issue or PR has been created in Linear for internal review

Comments

@easydigi
Copy link

easydigi commented Nov 14, 2024

Bug Description

The form node behaves unstably when using the Next page functionality.

In test mode, it can switch pages, but it will freeze after testing for a period of time.
With the official link after the form is published, it almost always freezes when navigating.

101731565595_ pic

The console occasionally reports errors:

n8n        | Referenced node is unexecuted
n8n        | ExpressionError: Referenced node is unexecuted
n8n        |     at createExpressionError (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-workflow@file+packages+workflow/node_modules/n8n-workflow/dist/WorkflowDataProxy.js:474:20)
n8n        |     at ensureNodeExecutionData (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-workflow@file+packages+workflow/node_modules/n8n-workflow/dist/WorkflowDataProxy.js:713:31)
n8n        |     at Object.get (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-workflow@file+packages+workflow/node_modules/n8n-workflow/dist/WorkflowDataProxy.js:812:29)
n8n        |     at findExtendedFunction (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-workflow@file+packages+workflow/node_modules/n8n-workflow/dist/Extensions/ExpressionExtension.js:281:56)
n8n        |     at Proxy.extend (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-workflow@file+packages+workflow/node_modules/n8n-workflow/dist/Extensions/ExpressionExtension.js:292:27)
n8n        |     at Proxy.eval (eval at getFunction (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@[email protected]/node_modules/@n8n/tournament/src/FunctionEvaluator.ts:13:16), <anonymous>:6:47)
n8n        |     at FunctionEvaluator.evaluate (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@[email protected]/node_modules/@n8n/tournament/src/FunctionEvaluator.ts:20:13)
n8n        |     at Tournament.execute (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@[email protected]/node_modules/@n8n/tournament/src/index.ts:45:25)
n8n        |     at evaluateExpression (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-workflow@file+packages+workflow/node_modules/n8n-workflow/dist/ExpressionEvaluatorProxy.js:113:16)
n8n        |     at Expression.renderExpression (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-workflow@file+packages+workflow/node_modules/n8n-workflow/dist/Expression.js:228:70)
n8n        | 
n8n        | There was a problem executing the workflow
n8n        | Error: There was a problem executing the workflow
n8n        |     at Object.executeWebhook (/usr/local/lib/node_modules/n8n/dist/webhooks/webhook-helpers.js:508:15)
n8n        |     at processTicksAndRejections (node:internal/process/task_queues:95:5)
n8n        | 
n8n        | Cannot read properties of undefined (reading 'data')
n8n        | TypeError: Cannot read properties of undefined (reading 'data')
n8n        |     at Object.executeWebhook (/usr/local/lib/node_modules/n8n/dist/webhooks/webhook-helpers.js:277:66)
n8n        |     at processTicksAndRejections (node:internal/process/task_queues:95:5)

To Reproduce

{
  "nodes": [
    {
      "parameters": {
        "formTitle": "step1",
        "formFields": {
          "values": [
            {
              "fieldLabel": "id"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2.2,
      "position": [
        -80,
        -120
      ],
      "id": "4a24d844-26e2-4978-b9ae-bf0e8aa45e1a",
      "name": "On form submission",
      "webhookId": "4359201b-12ca-428b-af70-b2dca374f685"
    },
    {
      "parameters": {
        "formFields": {
          "values": [
            {
              "fieldLabel": "id2"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.form",
      "typeVersion": 1,
      "position": [
        340,
        -20
      ],
      "id": "e6e1484d-6c5a-4528-89ce-5b4ce8f08ad9",
      "name": "Form",
      "webhookId": "34913d88-68b7-4680-8447-90be3e88ebee"
    }
  ],
  "connections": {
    "On form submission": {
      "main": [
        [
          {
            "node": "Form",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {}
}

Expected behavior

After clicking submit, it can navigate to the next page.

Operating System

Docker

n8n Version

1.67.1~1.68.0

Node.js Version

20

Database

PostgreSQL

Execution mode

queue

@Joffcom
Copy link
Member

Joffcom commented Nov 14, 2024

Hey @easydigi,

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

@Joffcom Joffcom added the in linear Issue or PR has been created in Linear for internal review label Nov 14, 2024
@Joffcom
Copy link
Member

Joffcom commented Nov 15, 2024

Hey @easydigi,

I am not able to reproduce this on 1.68.0, Were you able to hit the same issue with 1.68.0 as well?

@easydigi
Copy link
Author

Hey @easydigi,

I am not able to reproduce this on 1.68.0, Were you able to hit the same issue with 1.68.0 as well?

I am using version 1.68.0 in QUEUE mode. My environment is as follows:

Works x2
Webhooks x2
Main x1
nginx used as the frontend proxy

@easydigi
Copy link
Author

After investigation, the issue is more easily reproduced when two Webhooks are set up, approximately 3 to 4 times out of every 10 attempts. The backend debug information is as follows:

`webhook-2 | 2024-11-17T15:53:30.930Z | debug | Received webhook "POST" for path "4359201b-12ca-428b-af70-b2dca374f685" {"file":"live-webhooks.js","function":"executeWebhook"}
webhook-2 | 2024-11-17T15:53:30.950Z | debug | Execution added {"executionId":"7754","file":"active-executions.js","function":"add"}
webhook-2 | 2024-11-17T15:53:30.952Z | info | Enqueued execution 7754 (job 5706) {"scopes":["scaling"],"executionId":"7754","jobId":"5706","file":"scaling.service.js","function":"addJob"}
webhook-2 | 2024-11-17T15:53:30.952Z | debug | Started execution of workflow "workflow 12" from webhook with execution ID 7754 {"executionId":"7754","file":"webhook-helpers.js","function":"executeWebhook"}
webhook-2 | 2024-11-17T15:53:30.961Z | debug | Received waiting-form "GET" for execution "7754" {"file":"waiting-forms.js","function":"logReceivedWebhook"}
n8n-worker-2 | 2024-11-17T15:53:30.966Z | info | Worker started execution 7754 (job 5706) {"scopes":["scaling"],"executionId":"7754","jobId":"5706","file":"job-processor.js","function":"processJob"}
n8n-worker-2 | 2024-11-17T15:53:30.971Z | debug | Workflow execution started {"workflowId":"wZRZe1a5AFP3WFb2","file":"LoggerProxy.js","function":"exports.debug"}

n8n-worker-2 | 2024-11-17T15:53:30.972Z | debug | Start processing node "On form submission" {"node":"On form submission","workflowId":"wZRZe1a5AFP3WFb2","file":"LoggerProxy.js","function":"exports.debug"}

n8n-worker-2 | 2024-11-17T15:53:30.972Z | debug | Running node "On form submission" started {"node":"On form submission","workflowId":"wZRZe1a5AFP3WFb2","file":"LoggerProxy.js","function":"exports.debug"}
n8n-worker-2 | 2024-11-17T15:53:30.972Z | debug | Running node "On form submission" finished successfully {"node":"On form submission","workflowId":"wZRZe1a5AFP3WFb2","file":"LoggerProxy.js","function":"exports.debug"}

n8n-worker-2 | 2024-11-17T15:53:30.973Z | debug | Start processing node "Form" {"node":"Form","workflowId":"wZRZe1a5AFP3WFb2","file":"LoggerProxy.js","function":"exports.debug"}

n8n-worker-2 | 2024-11-17T15:53:30.973Z | debug | Running node "Form" started {"node":"Form","workflowId":"wZRZe1a5AFP3WFb2","file":"LoggerProxy.js","function":"exports.debug"}
n8n-worker-2 | 2024-11-17T15:53:30.974Z | debug | Queued worker execution status for execution 7754 (job 5706) is "waiting" {"scopes":["scaling"],"file":"job-processor.js","function":"additionalData.setExecutionStatus"}
n8n-worker-2 | 2024-11-17T15:53:30.974Z | debug | Running node "Form" finished successfully {"node":"Form","workflowId":"wZRZe1a5AFP3WFb2","file":"LoggerProxy.js","function":"exports.debug"}

n8n-worker-2 | 2024-11-17T15:53:30.974Z | debug | Save execution progress to database for execution ID 7754 {"executionId":"7754","nodeName":"Form","file":"save-execution-progress.js","function":"saveExecutionProgress"}
n8n-worker-2 | 2024-11-17T15:53:30.981Z | debug | Workflow execution will wait until Wed Jan 01 3000 00:00:00 GMT+0000 (Coordinated Universal Time) {"workflowId":"wZRZe1a5AFP3WFb2","file":"LoggerProxy.js","function":"exports.debug"}
n8n-worker-2 | 2024-11-17T15:53:30.981Z | debug | Executing hook (hookFunctionsSaveWorker) {"executionId":"7754","workflowId":"wZRZe1a5AFP3WFb2","file":"workflow-execute-additional-data.js","function":"workflowExecuteAfter"}
n8n-worker-2 | 2024-11-17T15:53:30.982Z | debug | Save execution data to database for execution ID 7754 {"executionId":"7754","workflowId":"wZRZe1a5AFP3WFb2","finished":false,"stoppedAt":"2024-11-17T15:53:30.981Z","file":"shared-hook-functions.js","function":"updateExistingExecution"}

n8n-worker-2 | 2024-11-17T15:53:30.985Z | info | Worker finished execution 7754 (job 5706) {"scopes":["scaling"],"executionId":"7754","jobId":"5706","file":"job-processor.js","function":"processJob"}
flows_n8n | 2024-11-17T15:53:30.986Z | info | Execution 7754 (job 5706) finished successfully {"scopes":["scaling"],"workerId":"worker-eug7FQvR2onKy5L5","executionId":"7754","jobId":"5706","file":"scaling.service.js"}
webhook-2 | 2024-11-17T15:53:30.987Z | info | Execution 7754 (job 5706) finished successfully {"scopes":["scaling"],"workerId":"worker-eug7FQvR2onKy5L5","executionId":"7754","jobId":"5706","file":"scaling.service.js"}
webhook-2 | 2024-11-17T15:53:30.990Z | debug | Execution finalized {"executionId":"7754","file":"active-executions.js","function":"finalizeExecution"}
webhook-2 | 2024-11-17T15:53:30.991Z | debug | Execution removed {"executionId":"7754","file":"active-executions.js"}`

The frontend received a 500 error, with the specific content as follows:

500 Internal Server Error {"code":0,"message":"Cannot read properties of undefined (reading 'pop')"}

@easydigi
Copy link
Author

Below are the logs from a normal operation, which appear to be Webhook requests. Sometimes, these requests occur earlier than the Worker startup time.

`webhook-2 | 2024-11-17T16:17:42.079Z | debug | Received webhook "GET" for path "4359201b-12ca-428b-af70-b2dca374f685" {"file":"live-webhooks.js","function":"executeWebhook"}
webhook-2 | 2024-11-17T16:17:56.279Z | debug | Received webhook "POST" for path "4359201b-12ca-428b-af70-b2dca374f685" {"file":"live-webhooks.js","function":"executeWebhook"}
webhook-2 | 2024-11-17T16:17:56.299Z | debug | Execution added {"executionId":"7770","file":"active-executions.js","function":"add"}
webhook-2 | 2024-11-17T16:17:56.301Z | info | Enqueued execution 7770 (job 5722) {"scopes":["scaling"],"executionId":"7770","jobId":"5722","file":"scaling.service.js","function":"addJob"}
webhook-2 | 2024-11-17T16:17:56.302Z | debug | Started execution of workflow "Workflow 12" from webhook with execution ID 7770 {"executionId":"7770","file":"webhook-helpers.js","function":"executeWebhook"}
n8n-worker-1 | 2024-11-17T16:17:56.305Z | info | Worker started execution 7770 (job 5722) {"scopes":["scaling"],"executionId":"7770","jobId":"5722","file":"job-processor.js","function":"processJob"}
n8n-worker-1 | 2024-11-17T16:17:56.309Z | debug | Workflow execution started {"workflowId":"wZRZe1a5AFP3WFb2","file":"LoggerProxy.js","function":"exports.debug"}
n8n-worker-1 | 2024-11-17T16:17:56.310Z | debug | Start processing node "On form submission" {"node":"On form submission","workflowId":"wZRZe1a5AFP3WFb2","file":"LoggerProxy.js","function":"exports.debug"}
n8n-worker-1 | 2024-11-17T16:17:56.311Z | debug | Running node "On form submission" started {"node":"On form submission","workflowId":"wZRZe1a5AFP3WFb2","file":"LoggerProxy.js","function":"exports.debug"}
n8n-worker-1 | 2024-11-17T16:17:56.311Z | debug | Running node "On form submission" finished successfully {"node":"On form submission","workflowId":"wZRZe1a5AFP3WFb2","file":"LoggerProxy.js","function":"exports.debug"}
n8n-worker-1 | 2024-11-17T16:17:56.311Z | debug | Start processing node "Form" {"node":"Form","workflowId":"wZRZe1a5AFP3WFb2","file":"LoggerProxy.js","function":"exports.debug"}

n8n-worker-1 | 2024-11-17T16:17:56.312Z | debug | Running node "Form" started {"node":"Form","workflowId":"wZRZe1a5AFP3WFb2","file":"LoggerProxy.js","function":"exports.debug"}
n8n-worker-1 | 2024-11-17T16:17:56.312Z | debug | Queued worker execution status for execution 7770 (job 5722) is "waiting" {"scopes":["scaling"],"file":"job-processor.js","function":"additionalData.setExecutionStatus"}
n8n-worker-1 | 2024-11-17T16:17:56.313Z | debug | Running node "Form" finished successfully {"node":"Form","workflowId":"wZRZe1a5AFP3WFb2","file":"LoggerProxy.js","function":"exports.debug"}

n8n-worker-1 | 2024-11-17T16:17:56.313Z | debug | Save execution progress to database for execution ID 7770 {"executionId":"7770","nodeName":"Form","file":"save-execution-progress.js","function":"saveExecutionProgress"}
webhook-2 | 2024-11-17T16:17:56.313Z | debug | Received waiting-form "GET" for execution "7770" {"file":"waiting-forms.js","function":"logReceivedWebhook"}
n8n-worker-1 | 2024-11-17T16:17:56.320Z | debug | Workflow execution will wait until Wed Jan 01 3000 00:00:00 GMT+0000 (Coordinated Universal Time) {"workflowId":"wZRZe1a5AFP3WFb2","file":"LoggerProxy.js","function":"exports.debug"}
n8n-worker-1 | 2024-11-17T16:17:56.320Z | debug | Executing hook (hookFunctionsSaveWorker) {"executionId":"7770","workflowId":"wZRZe1a5AFP3WFb2","file":"workflow-execute-additional-data.js","function":"workflowExecuteAfter"}
n8n-worker-1 | 2024-11-17T16:17:56.321Z | debug | Save execution data to database for execution ID 7770 {"executionId":"7770","workflowId":"wZRZe1a5AFP3WFb2","finished":false,"stoppedAt":"2024-11-17T16:17:56.320Z","file":"shared-hook-functions.js","function":"updateExistingExecution"}

n8n-worker-1 | 2024-11-17T16:17:56.324Z | info | Worker finished execution 7770 (job 5722) {"scopes":["scaling"],"executionId":"7770","jobId":"5722","file":"job-processor.js","function":"processJob"}
flows_n8n | 2024-11-17T16:17:56.325Z | info | Execution 7770 (job 5722) finished successfully {"scopes":["scaling"],"workerId":"worker-ALkwD4CDkJ21o6O5","executionId":"7770","jobId":"5722","file":"scaling.service.js"}
webhook-2 | 2024-11-17T16:17:56.325Z | info | Execution 7770 (job 5722) finished successfully {"scopes":["scaling"],"workerId":"worker-ALkwD4CDkJ21o6O5","executionId":"7770","jobId":"5722","file":"scaling.service.js"}
webhook-2 | 2024-11-17T16:17:56.329Z | debug | Execution finalized {"executionId":"7770","file":"active-executions.js","function":"finalizeExecution"}
webhook-2 | 2024-11-17T16:17:56.329Z | debug | Execution removed {"executionId":"7770","file":"active-executions.js"}
webhook-2 | 2024-11-17T16:17:57.377Z | debug | Received waiting-form "GET" for execution "7770" {"file":"waiting-forms.js","function":"logReceivedWebhook"}
webhook-2 | 2024-11-17T16:17:57.407Z | debug | Received waiting-form "GET" for execution "7770" {"file":"waiting-forms.js","function":"logReceivedWebhook"}
flows_n8n | 2024-11-17T16:17:59.011Z | debug | Querying database for waiting executions {"scopes":["waiting-executions"],"file":"wait-tracker.js","function":"getWaitingExecutions"}
`

@Joffcom
Copy link
Member

Joffcom commented Nov 18, 2024

Hey @easydigi,

In your set up do you have your load balancer set up to make sure all test requests only go to the main instance and the productions only go to the webhook workers?

@easydigi
Copy link
Author

easydigi commented Nov 20, 2024

Hey @easydigi,

In your set up do you have your load balancer set up to make sure all test requests only go to the main instance and the productions only go to the webhook workers?

Yes, I used load balancing, and the Webhook uses a different domain name from the main instance:

In the testing environment, the first page of the form is triggered through the main instance (using the domain name of the main instance). However, when redirecting to the form-waiting page, it automatically switches to the Webhook's domain name. Generally, this doesn't cause errors in the testing environment.

In the production environment, it's confirmed that the same Webhook is used. In the production environment, if you don't immediately click "submit" on the first page but wait for a few seconds, the likelihood of an error occurring is significantly reduced. However, if you click submit immediately, the probability of an error increases greatly. Moreover, when one form-waiting page hasn't been clicked and more form-waiting pages are triggered, the probability of errors also increases.

@easydigi
Copy link
Author

easydigi commented Nov 20, 2024

nginx -> traefik - >
--------------- Docker -------------
->Main - domain:n8n.xxx.com
->Works x2
->Webhook x2. - domain:api.xxx.com

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
Projects
None yet
Development

No branches or pull requests

2 participants