mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-22 12:19:09 +00:00
fix: Workflow activation should not crash if one of the credential is invalid (#4671)
fix: workflow activation should not crash if one of the credential is invalid fixes https://sentry.io/organizations/n8nio/issues/3755260584
This commit is contained in:
committed by
GitHub
parent
30e5d3d04c
commit
c0e13c2a8f
@@ -1,6 +1,7 @@
|
|||||||
import { validate as jsonSchemaValidate } from 'jsonschema';
|
import { validate as jsonSchemaValidate } from 'jsonschema';
|
||||||
import { INode, IPinData, JsonObject, jsonParse, LoggerProxy, Workflow } from 'n8n-workflow';
|
import { INode, IPinData, JsonObject, jsonParse, LoggerProxy, Workflow } from 'n8n-workflow';
|
||||||
import { FindManyOptions, FindOneOptions, In, ObjectLiteral } from 'typeorm';
|
import { FindManyOptions, FindOneOptions, In, ObjectLiteral } from 'typeorm';
|
||||||
|
import pick from 'lodash.pick';
|
||||||
import * as ActiveWorkflowRunner from '@/ActiveWorkflowRunner';
|
import * as ActiveWorkflowRunner from '@/ActiveWorkflowRunner';
|
||||||
import * as Db from '@/Db';
|
import * as Db from '@/Db';
|
||||||
import { InternalHooksManager } from '@/InternalHooksManager';
|
import { InternalHooksManager } from '@/InternalHooksManager';
|
||||||
@@ -254,9 +255,18 @@ export class WorkflowsService {
|
|||||||
await validateEntity(workflow);
|
await validateEntity(workflow);
|
||||||
}
|
}
|
||||||
|
|
||||||
const { hash, ...rest } = workflow;
|
await Db.collections.Workflow.update(
|
||||||
|
workflowId,
|
||||||
await Db.collections.Workflow.update(workflowId, rest);
|
pick(workflow, [
|
||||||
|
'name',
|
||||||
|
'active',
|
||||||
|
'nodes',
|
||||||
|
'connections',
|
||||||
|
'settings',
|
||||||
|
'staticData',
|
||||||
|
'pinData',
|
||||||
|
]),
|
||||||
|
);
|
||||||
|
|
||||||
if (tags && !config.getEnv('workflowTagsDisabled')) {
|
if (tags && !config.getEnv('workflowTagsDisabled')) {
|
||||||
const tablePrefix = config.getEnv('database.tablePrefix');
|
const tablePrefix = config.getEnv('database.tablePrefix');
|
||||||
@@ -306,8 +316,7 @@ export class WorkflowsService {
|
|||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// If workflow could not be activated set it again to inactive
|
// If workflow could not be activated set it again to inactive
|
||||||
workflow.active = false;
|
await Db.collections.Workflow.update(workflowId, { active: false });
|
||||||
await Db.collections.Workflow.update(workflowId, workflow);
|
|
||||||
|
|
||||||
// Also set it in the returned data
|
// Also set it in the returned data
|
||||||
updatedWorkflow.active = false;
|
updatedWorkflow.active = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user