fix(core): Prevent issues with missing or mismatching encryption key (#8332)

This commit is contained in:
Iván Ovejero
2024-01-16 18:25:53 +01:00
committed by GitHub
parent 7bb2d1799e
commit d4c93b1607
7 changed files with 62 additions and 45 deletions

View File

@@ -259,6 +259,13 @@ export class Worker extends BaseCommand {
constructor(argv: string[], cmdConfig: IConfig) {
super(argv, cmdConfig);
if (!process.env.N8N_ENCRYPTION_KEY) {
throw new ApplicationError(
'Missing encryption key. Worker started without the required N8N_ENCRYPTION_KEY env var. More information: https://docs.n8n.io/hosting/environment-variables/configuration-methods/#encryption-key',
);
}
this.setInstanceType('worker');
this.setInstanceQueueModeId();
}

View File

@@ -14,7 +14,7 @@ if (inE2ETests) {
process.env.N8N_AI_ENABLED = 'true';
} else if (inTest) {
process.env.N8N_LOG_LEVEL = 'silent';
process.env.N8N_ENCRYPTION_KEY = 'test-encryption-key';
process.env.N8N_ENCRYPTION_KEY = 'test_key';
process.env.N8N_PUBLIC_API_DISABLED = 'true';
process.env.SKIP_STATISTICS_EVENTS = 'true';
} else {