fix(core): Make task runner oom error message more user friendly (no-changelog) (#11646)
Some checks failed
Test Master / install-and-build (push) Has been cancelled
Test Master / Unit tests (18.x) (push) Has been cancelled
Test Master / Unit tests (20.x) (push) Has been cancelled
Test Master / Unit tests (22.4) (push) Has been cancelled
Test Master / Lint (push) Has been cancelled
Test Master / Notify Slack on failure (push) Has been cancelled

This commit is contained in:
Tomi Turtiainen 2024-11-08 20:27:37 +02:00 committed by GitHub
parent fb06b55211
commit 0fdb79a270
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -5,18 +5,22 @@ import type { TaskRunner } from '../task-broker.service';
export class TaskRunnerOomError extends ApplicationError { export class TaskRunnerOomError extends ApplicationError {
public description: string; public description: string;
constructor(runnerId: TaskRunner['id'], isCloudDeployment: boolean) { constructor(
super(`Task runner (${runnerId}) ran out of memory.`, { level: 'error' }); public readonly runnerId: TaskRunner['id'],
isCloudDeployment: boolean,
) {
super('Node ran out of memory.', { level: 'error' });
const fixSuggestions = { const fixSuggestions = {
reduceItems: 'Reduce the number of items processed at a time by batching the input.', reduceItems:
'Reduce the number of items processed at a time, by batching them using a loop node',
increaseMemory: increaseMemory:
"Increase the memory available to the task runner with 'N8N_RUNNERS_MAX_OLD_SPACE_SIZE' environment variable.", "Increase the memory available to the task runner with 'N8N_RUNNERS_MAX_OLD_SPACE_SIZE' environment variable",
upgradePlan: 'Upgrade your cloud plan to increase the available memory.', upgradePlan: 'Upgrade your cloud plan to increase the available memory',
}; };
const subtitle = const subtitle =
'The runner executing the code ran out of memory. This usually happens when there are too many items to process. You can try the following:'; 'This usually happens when there are too many items to process. You can try the following:';
const suggestions = isCloudDeployment const suggestions = isCloudDeployment
? [fixSuggestions.reduceItems, fixSuggestions.upgradePlan] ? [fixSuggestions.reduceItems, fixSuggestions.upgradePlan]
: [fixSuggestions.reduceItems, fixSuggestions.increaseMemory]; : [fixSuggestions.reduceItems, fixSuggestions.increaseMemory];