n8n-io/n8n

Form trigger error in queue mode deployment

Yoshino-s opened this issue · 3 comments

Bug Description

constructor() {
super('main');
this.app.engine('handlebars', expressHandlebars({ defaultLayout: false }));
this.app.set('view engine', 'handlebars');
this.app.set('views', TEMPLATES_DIR);
this.testWebhooksEnabled = true;
this.webhooksEnabled = !config.getEnv('endpoints.disableProductionWebhooksOnMainProcess');
}

In main server, it register the view engine. But

export class WebhookServer extends AbstractServer {
constructor() {
super('webhook');
}
}

In WebhookServer , it doesn't register view engine, which cause /form/:path showing error like

{
  "errorMessage": "No default engine was specified and no extension was provided.",
  "errorDetails": {},
  "n8nDetails": {
    "n8nVersion": "1.39.0 (Self Hosted)",
    "binaryDataMode": "default",
    "stackTrace": [
      "Error: No default engine was specified and no extension was provided.",
      "    at new View (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/express@4.19.2/node_modules/express/lib/view.js:61:11)",
      "    at Function.render (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/express@4.19.2/node_modules/express/lib/application.js:587:12)",
      "    at ServerResponse.render (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/express@4.19.2/node_modules/express/lib/response.js:1048:7)",
      "    at formWebhook (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/file+packages+nodes-base_asn1.js@5.4.1_date-fns@2.30.0_promise-ftp-common@1.1.5_zod@3.22.4/node_modules/n8n-nodes-base/dist/nodes/Form/utils.js:98:13)",
      "    at Object.webhook (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/file+packages+nodes-base_asn1.js@5.4.1_date-fns@2.30.0_promise-ftp-common@1.1.5_zod@3.22.4/node_modules/n8n-nodes-base/dist/nodes/Form/v2/FormTriggerV2.node.js:89:46)",
      "    at Workflow.runWebhook (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/file+packages+workflow/node_modules/n8n-workflow/dist/Workflow.js:665:38)",
      "    at Object.executeWebhook (/usr/local/lib/node_modules/n8n/dist/WebhookHelpers.js:226:48)",
      "    at processTicksAndRejections (node:internal/process/task_queues:95:5)"
    ]
  }
}

To Reproduce

  1. Deploy the n8n in queue mode
  2. Make a workflow with Form Trigger
  3. Activate it and goto the form link like http://domain.ltd/form/:path
  4. A 404 error occure and an error shows in the execution history

Expected behavior

The form page show

Operating System

Docker

n8n Version

1.39.0/nightly

Node.js Version

v18.19.1

Database

PostgreSQL

Execution mode

queue

Hey @Yoshino-s,

This is a duplicate of #7538 so for now I am going to close this one.

My mistake this is a different issue....

Edit: Actually looking again I think it is the same, I have added this to the existing NODE-888 ticket anyway to handle it and check your PR.

Fix got released with n8n@1.40.0