Registering multiple backend hooks

Describe the problem/error/question

I have 2 external backend hooks I’d like to register with n8n via the EXTERNAL_HOOK_FILES env var. However, as stated in the documentation, separating the files using a semicolon ( ; ) doesn’t work and results in the following error:

However, if I separate the files using a colon ( : ) both are successfully registered and work as expected.

Is this a fault in the documentation, or am I misunderstanding something?

What is the error message (if any)?

Error message when trying to register 2 external hook files using a semicolon:
Command:
EXTERNAL_HOOK_FILES=/home/node/n8n/hooks/workflows.js;/home/node/n8n/hooks/credentials.js
Error:
n8n | Error: Problem loading external hook file
n8n | at ExternalHooks.loadHooksFiles (/usr/local/lib/node_modules/n8n/dist/ExternalHooks.js:64:27)
n8n | at ExternalHooks.init (/usr/local/lib/node_modules/n8n/dist/ExternalHooks.js:38:20)
n8n | at Start.initExternalHooks (/usr/local/lib/node_modules/n8n/dist/commands/BaseCommand.js:201:34)
n8n | at Start.init (/usr/local/lib/node_modules/n8n/dist/commands/start.js:140:20)
n8n | at Start._run (/usr/local/lib/node_modules/n8n/node_modules/@oclif/core/lib/command.js:303:13)
n8n | at Config.runCommand (/usr/local/lib/node_modules/n8n/node_modules/@oclif/core/lib/config/config.js:417:25)
n8n | at run (/usr/local/lib/node_modules/n8n/node_modules/@oclif/core/lib/main.js:85:16)
n8n | at /usr/local/lib/node_modules/n8n/bin/n8n:49:2
n8n | 2024-02-26T10:27:41.820Z | error | Error: Exiting due to an error. “{ file: ‘LoggerProxy.js’, function: ‘exports.error’ }”
n8n | 2024-02-26T10:27:41.820Z | error | ApplicationError: Problem loading external hook file “{\n errorMessage: "Cannot find module ‘/home/node/n8n/hooks/workflows.js;/home/node/n8n/hooks/credentials.js’\n" +\n ‘Require stack:\n’ +\n ‘- /usr/local/lib/node_modules/n8n/dist/ExternalHooks.js\n’ +\n ‘- /usr/local/lib/node_modules/n8n/dist/commands/BaseCommand.js\n’ +\n ‘- /usr/local/lib/node_modules/n8n/node_modules/@oclif/core/lib/module-loader.js\n’ +\n ‘- /usr/local/lib/node_modules/n8n/node_modules/@oclif/core/lib/help/index.js\n’ +\n ‘- /usr/local/lib/node_modules/n8n/node_modules/@oclif/core/lib/flags.js\n’ +\n ‘- /usr/local/lib/node_modules/n8n/node_modules/@oclif/core/lib/cli-ux/styled/table.js\n’ +\n ‘- /usr/local/lib/node_modules/n8n/node_modules/@oclif/core/lib/cli-ux/styled/index.js\n’ +\n ‘- /usr/local/lib/node_modules/n8n/node_modules/@oclif/core/lib/cli-ux/index.js\n’ +\n ‘- /usr/local/lib/node_modules/n8n/node_modules/@oclif/core/lib/index.js’,\n hookFilePath: ‘/home/node/n8n/hooks/workflows.js;/home/node/n8n/hooks/credentials.js’,\n file: ‘LoggerProxy.js’,\n function: ‘exports.error’\n}”
n8n | 2024-02-26T10:27:41.821Z | error | Error: Cannot find module ‘/home/node/n8n/hooks/workflows.js;/home/node/n8n/hooks/credentials.js’
n8n | Require stack:
n8n | - /usr/local/lib/node_modules/n8n/dist/ExternalHooks.js
n8n | - /usr/local/lib/node_modules/n8n/dist/commands/BaseCommand.js
n8n | - /usr/local/lib/node_modules/n8n/node_modules/@oclif/core/lib/module-loader.js
n8n | - /usr/local/lib/node_modules/n8n/node_modules/@oclif/core/lib/help/index.js
n8n | - /usr/local/lib/node_modules/n8n/node_modules/@oclif/core/lib/flags.js
n8n | - /usr/local/lib/node_modules/n8n/node_modules/@oclif/core/lib/cli-ux/styled/table.js
n8n | - /usr/local/lib/node_modules/n8n/node_modules/@oclif/core/lib/cli-ux/styled/index.js
n8n | - /usr/local/lib/node_modules/n8n/node_modules/@oclif/core/lib/cli-ux/index.js
n8n | - /usr/local/lib/node_modules/n8n/node_modules/@oclif/core/lib/index.js “{ file: ‘LoggerProxy.js’, function: ‘exports.error’ }”

Thanks for the help!!

Information on your n8n setup

  • n8n version: 1.28.0
  • Database (default: SQLite): PostGres
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): docker
  • Operating system: Ubuntu 22.04

Hey @dingo-dev!

According to the documentation this field is colon-separated, not semi-colon:

Files containing external hooks. Provide multiple files as a colon-separated list (": ").

Can you give that a try and let me know if that fixed it?

1 Like

Hi @bartv

Thank for pointing me to the right place.

I had another look and realised I was looking at the Embed documentation!

Thank you for the help!!

2 Likes

You’re welcome!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.