fix(core)!: Make runners the only Code node option (#22689)

This commit is contained in:
Iván Ovejero
2025-12-03 17:36:55 +01:00
committed by GitHub
parent 7a04304b7c
commit 8424755513
6 changed files with 15 additions and 39 deletions
@@ -8,8 +8,7 @@ export type TaskRunnerMode = z.infer<typeof runnerModeSchema>;
@Config
export class TaskRunnersConfig {
@Env('N8N_RUNNERS_ENABLED')
enabled: boolean = false;
enabled: boolean = true;
/**
* Whether the task runner should run as a child process spawned by n8n (internal mode)
+1 -1
View File
@@ -263,7 +263,7 @@ describe('GlobalConfig', () => {
},
},
taskRunners: {
enabled: false,
enabled: true,
mode: 'internal',
path: '/runners',
authToken: '',
@@ -83,33 +83,6 @@ describe('DeprecationService', () => {
toTest('DB_TYPE', dbType, mustWarn);
});
describe('N8N_RUNNERS_ENABLED', () => {
const envVar = 'N8N_RUNNERS_ENABLED';
test.each([
['false', true],
['', true],
['true', false],
[undefined /* warnIfMissing */, true],
])('should handle value: %s', (value, mustWarn) => {
toTest(envVar, value, mustWarn);
});
test('should not warn when Code node is excluded', () => {
process.env[envVar] = 'false';
const globalConfig = mockInstance(GlobalConfig, {
nodes: {
exclude: ['n8n-nodes-base.code'],
},
});
new DeprecationService(logger, globalConfig, instanceSettings).warn();
expect(logger.warn).not.toHaveBeenCalled();
});
});
describe('OFFLOAD_MANUAL_EXECUTIONS_TO_WORKERS', () => {
const envVar = 'OFFLOAD_MANUAL_EXECUTIONS_TO_WORKERS';
@@ -55,14 +55,6 @@ export class DeprecationService {
envVar: 'N8N_SKIP_WEBHOOK_DEREGISTRATION_SHUTDOWN',
message: `n8n no longer deregisters webhooks at startup and shutdown. ${SAFE_TO_REMOVE}`,
},
{
envVar: 'N8N_RUNNERS_ENABLED',
message:
'Running n8n without task runners is deprecated. Task runners will be turned on by default in a future version. Please set `N8N_RUNNERS_ENABLED=true` to enable task runners now and avoid potential issues in the future. Learn more: https://docs.n8n.io/hosting/configuration/task-runners/',
checkValue: (value?: string) => value?.toLowerCase() !== 'true' && value !== '1',
warnIfMissing: true,
disableIf: () => this.globalConfig.nodes.exclude.includes('n8n-nodes-base.code'),
},
{
envVar: 'OFFLOAD_MANUAL_EXECUTIONS_TO_WORKERS',
message:
+7
View File
@@ -1 +1,8 @@
import 'reflect-metadata';
import { TaskRunnersConfig } from '@n8n/config';
import { Container } from '@n8n/di';
// Disable task runners for tests until proper mocking is implemented
const taskRunnersConfig = new TaskRunnersConfig();
taskRunnersConfig.enabled = false;
Container.set(TaskRunnersConfig, taskRunnersConfig);
+6 -1
View File
@@ -1,8 +1,13 @@
import 'reflect-metadata';
import { TaskRunnersConfig } from '@n8n/config';
import { Container } from '@n8n/di';
// Disable task runners until we have fixed the "run test workflows" test
// to mock the Code Node execution
process.env.N8N_RUNNERS_ENABLED = 'false';
const taskRunnersConfig = new TaskRunnersConfig();
taskRunnersConfig.enabled = false;
Container.set(TaskRunnersConfig, taskRunnersConfig);
process.env.N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS = 'false';
process.env.N8N_VERSION = '0.0.0-test';
// Disable file access restrictions for tests so they can read/write test files