diff --git a/packages/cli/commands/start.ts b/packages/cli/commands/start.ts index d12957209a..253877e564 100644 --- a/packages/cli/commands/start.ts +++ b/packages/cli/commands/start.ts @@ -312,6 +312,9 @@ export class Start extends Command { ); } + const instanceId = await UserSettings.getInstanceId(); + InternalHooksManager.init(instanceId); + await Server.start(); // Start to get active workflows and run their triggers diff --git a/packages/cli/commands/webhook.ts b/packages/cli/commands/webhook.ts index 97876e5235..a5f926682f 100644 --- a/packages/cli/commands/webhook.ts +++ b/packages/cli/commands/webhook.ts @@ -18,6 +18,7 @@ import { Db, ExternalHooks, GenericHelpers, + InternalHooksManager, LoadNodesAndCredentials, NodeTypes, WebhookServer, @@ -147,6 +148,9 @@ export class Webhook extends Command { // Wait till the database is ready await startDbInitPromise; + const instanceId = await UserSettings.getInstanceId(); + InternalHooksManager.init(instanceId); + if (config.get('executions.mode') === 'queue') { const redisHost = config.get('queue.bull.redis.host'); const redisPassword = config.get('queue.bull.redis.password'); diff --git a/packages/cli/commands/worker.ts b/packages/cli/commands/worker.ts index baacad83b9..9a06868f3a 100644 --- a/packages/cli/commands/worker.ts +++ b/packages/cli/commands/worker.ts @@ -26,7 +26,7 @@ import { IBullJobData, IBullJobResponse, IExecutionFlattedDb, - IExecutionResponse, + InternalHooksManager, LoadNodesAndCredentials, NodeTypes, ResponseHelper, @@ -259,6 +259,9 @@ export class Worker extends Command { // eslint-disable-next-line @typescript-eslint/no-floating-promises Worker.jobQueue.process(flags.concurrency, async (job) => this.runJob(job, nodeTypes)); + const instanceId = await UserSettings.getInstanceId(); + InternalHooksManager.init(instanceId); + const versions = await GenericHelpers.getVersions(); console.info('\nn8n worker is now ready'); diff --git a/packages/cli/src/Server.ts b/packages/cli/src/Server.ts index 61a58febb5..e9de494f44 100644 --- a/packages/cli/src/Server.ts +++ b/packages/cli/src/Server.ts @@ -312,8 +312,6 @@ class App { this.frontendSettings.personalizationSurvey = await PersonalizationSurvey.preparePersonalizationSurvey(); - InternalHooksManager.init(this.frontendSettings.instanceId); - await this.externalHooks.run('frontend.settings', [this.frontendSettings]); const excludeEndpoints = config.get('security.excludeEndpoints') as string;