mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix(core): Restore workflow ID during execution creation (#8031)
## Summary Restore workflow ID during execution creation removed by [this PR](https://github.com/n8n-io/n8n/pull/8002/files#diff-c8cbb62ca9ab2ae45e5f565cd8c63fff6475809a6241ea0b90acc575615224af). The missing workflow ID, and more generally the fact that `workflow.id` is optional when it should not be, causes `PermissionChecker.check` to misreport a credential as inaccessible when it should be accessible. More generally, start reporting ID-less workflows so we can root them out and prevent this at type level. ## Related tickets and issues https://n8nio.slack.com/archives/C035KBDA917/p1702539465555529
This commit is contained in:
@@ -52,6 +52,7 @@ import { RoutingNode } from './RoutingNode';
|
||||
import { Expression } from './Expression';
|
||||
import { NODES_WITH_RENAMABLE_CONTENT } from './Constants';
|
||||
import { ApplicationError } from './errors/application.error';
|
||||
import * as EventReporter from './ErrorReporterProxy';
|
||||
|
||||
function dedupe<T>(arr: T[]): T[] {
|
||||
return [...new Set(arr)];
|
||||
@@ -94,7 +95,14 @@ export class Workflow {
|
||||
settings?: IWorkflowSettings;
|
||||
pinData?: IPinData;
|
||||
}) {
|
||||
this.id = parameters.id as string;
|
||||
if (!parameters.id) {
|
||||
EventReporter.report('Detected ID-less workflow', {
|
||||
level: 'info',
|
||||
extra: { parameters },
|
||||
});
|
||||
}
|
||||
|
||||
this.id = parameters.id as string; // @tech_debt Ensure this is not optional
|
||||
this.name = parameters.name;
|
||||
this.nodeTypes = parameters.nodeTypes;
|
||||
this.pinData = parameters.pinData;
|
||||
|
||||
Reference in New Issue
Block a user