From e40de089f6b5d6426c386a3c2ad7700d7b31ce4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=A4=95=E0=A4=BE=E0=A4=B0=E0=A4=A4=E0=A5=8B=E0=A4=AB?= =?UTF-8?q?=E0=A5=8D=E0=A4=AB=E0=A5=87=E0=A4=B2=E0=A4=B8=E0=A5=8D=E0=A4=95?= =?UTF-8?q?=E0=A5=8D=E0=A4=B0=E0=A4=BF=E0=A4=AA=E0=A5=8D=E0=A4=9F=E2=84=A2?= Date: Wed, 14 Feb 2024 14:30:33 +0100 Subject: [PATCH] fix(core): Improve the startup error when EXECUTIONS_PROCESS is set to `own` --- packages/cli/bin/n8n | 20 ++++++++++++++++++++ packages/cli/src/commands/BaseCommand.ts | 5 ----- packages/cli/src/config/index.ts | 5 ----- packages/cli/src/config/schema.ts | 8 -------- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/packages/cli/bin/n8n b/packages/cli/bin/n8n index 005cd983cfcea..a10a821f756ff 100755 --- a/packages/cli/bin/n8n +++ b/packages/cli/bin/n8n @@ -44,6 +44,26 @@ if (process.env.NODEJS_PREFER_IPV4 === 'true') { require('dns').setDefaultResultOrder('ipv4first'); } +const colors = require('picocolors'); +const executionProcess = process.env.EXECUTIONS_PROCESS; +if (executionProcess) { + console.error( + colors.yellow('Please unset the deprecated env variable'), + colors.bold(colors.yellow('EXECUTIONS_PROCESS')), + ); +} +if (executionProcess === 'own') { + console.error( + colors.bold(colors.red('Application failed to start because "Own" mode has been removed.')), + ); + console.error( + colors.red( + 'If you need the isolation and performance gains, please consider using queue mode instead.\n\n', + ), + ); + process.exit(-1); +} + (async () => { const oclif = await import('@oclif/core'); await oclif.execute({}); diff --git a/packages/cli/src/commands/BaseCommand.ts b/packages/cli/src/commands/BaseCommand.ts index 5cd5b0cbbfe02..faa5db165df43 100644 --- a/packages/cli/src/commands/BaseCommand.ts +++ b/packages/cli/src/commands/BaseCommand.ts @@ -83,11 +83,6 @@ export abstract class BaseCommand extends Command { 'Support for MySQL/MariaDB has been deprecated and will be removed with an upcoming version of n8n. Please migrate to PostgreSQL.', ); } - if (process.env.EXECUTIONS_PROCESS === 'own') { - throw new ApplicationError( - 'Own mode has been removed. If you need the isolation and performance gains, please consider using queue mode.', - ); - } if (process.env.N8N_SKIP_WEBHOOK_DEREGISTRATION_SHUTDOWN) { this.logger.warn( diff --git a/packages/cli/src/config/index.ts b/packages/cli/src/config/index.ts index 6a83f7e6d57f1..5cc2d2a0c1829 100644 --- a/packages/cli/src/config/index.ts +++ b/packages/cli/src/config/index.ts @@ -73,11 +73,6 @@ if (userManagement.jwtRefreshTimeoutHours >= userManagement.jwtSessionDurationHo config.set('userManagement.jwtRefreshTimeoutHours', 0); } -if (config.getEnv('executions.process') !== 'IGNORED') { - throw new ApplicationError( - 'Own mode has been removed. If you need the isolation and performance gains, please consider using queue mode.', - ); -} setGlobalState({ defaultTimezone: config.getEnv('generic.timezone'), diff --git a/packages/cli/src/config/schema.ts b/packages/cli/src/config/schema.ts index c4c1566b03016..4402f82838d45 100644 --- a/packages/cli/src/config/schema.ts +++ b/packages/cli/src/config/schema.ts @@ -234,14 +234,6 @@ export const schema = { }, executions: { - // By default workflows get always executed in the main process. - // TODO: remove this and all usage of `executions.process` when we're sure that nobody has this in their config file anymore. - process: { - doc: 'Own mode has been removed and is only here for backwards compatibility of config files. N8n will use main mode for executions unless `executions.mode` is set to `queue`.', - format: ['main', 'own', 'IGNORED'] as const, - default: 'IGNORED', - env: 'EXECUTIONS_PROCESS', - }, mode: { doc: 'If it should run executions directly or via queue', format: ['regular', 'queue'] as const,