mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
fix: Prevent workflow breaking when credential type is unknown (#6923)
This commit is contained in:
@@ -126,7 +126,7 @@ export const nodeHelpers = defineComponent({
|
||||
}
|
||||
}
|
||||
|
||||
if (this.hasNodeExecutionIssues(node) === true && !ignoreIssues.includes('execution')) {
|
||||
if (this.hasNodeExecutionIssues(node) && !ignoreIssues.includes('execution')) {
|
||||
if (nodeIssues === null) {
|
||||
nodeIssues = {};
|
||||
}
|
||||
@@ -245,7 +245,7 @@ export const nodeHelpers = defineComponent({
|
||||
const foundIssues: INodeIssueObjectProperty = {};
|
||||
|
||||
let userCredentials: ICredentialsResponse[] | null;
|
||||
let credentialType: ICredentialType | null;
|
||||
let credentialType: ICredentialType | undefined;
|
||||
let credentialDisplayName: string;
|
||||
let selectedCredentials: INodeCredentialsDetails;
|
||||
|
||||
@@ -258,7 +258,7 @@ export const nodeHelpers = defineComponent({
|
||||
selectedCredsAreUnusable(node, genericAuthType)
|
||||
) {
|
||||
const credential = this.credentialsStore.getCredentialTypeByName(genericAuthType);
|
||||
return this.reportUnsetCredential(credential);
|
||||
return credential ? this.reportUnsetCredential(credential) : null;
|
||||
}
|
||||
|
||||
if (
|
||||
@@ -271,7 +271,7 @@ export const nodeHelpers = defineComponent({
|
||||
|
||||
if (selectedCredsDoNotExist(node, nodeCredentialType, stored)) {
|
||||
const credential = this.credentialsStore.getCredentialTypeByName(nodeCredentialType);
|
||||
return this.reportUnsetCredential(credential);
|
||||
return credential ? this.reportUnsetCredential(credential) : null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -282,7 +282,7 @@ export const nodeHelpers = defineComponent({
|
||||
selectedCredsAreUnusable(node, nodeCredentialType)
|
||||
) {
|
||||
const credential = this.credentialsStore.getCredentialTypeByName(nodeCredentialType);
|
||||
return this.reportUnsetCredential(credential);
|
||||
return credential ? this.reportUnsetCredential(credential) : null;
|
||||
}
|
||||
|
||||
for (const credentialTypeDescription of nodeType.credentials) {
|
||||
@@ -301,7 +301,7 @@ export const nodeHelpers = defineComponent({
|
||||
credentialDisplayName = credentialType.displayName;
|
||||
}
|
||||
|
||||
if (!node.credentials || !node.credentials?.[credentialTypeDescription.name]) {
|
||||
if (!node.credentials?.[credentialTypeDescription.name]) {
|
||||
// Credentials are not set
|
||||
if (credentialTypeDescription.required) {
|
||||
foundIssues[credentialTypeDescription.name] = [
|
||||
@@ -312,9 +312,7 @@ export const nodeHelpers = defineComponent({
|
||||
}
|
||||
} else {
|
||||
// If they are set check if the value is valid
|
||||
selectedCredentials = node.credentials[
|
||||
credentialTypeDescription.name
|
||||
] as INodeCredentialsDetails;
|
||||
selectedCredentials = node.credentials[credentialTypeDescription.name];
|
||||
if (typeof selectedCredentials === 'string') {
|
||||
selectedCredentials = {
|
||||
id: null,
|
||||
@@ -409,16 +407,14 @@ export const nodeHelpers = defineComponent({
|
||||
return [];
|
||||
}
|
||||
const executionData = this.workflowsStore.getWorkflowExecution.data;
|
||||
if (!executionData || !executionData.resultData) {
|
||||
if (!executionData?.resultData) {
|
||||
// unknown status
|
||||
return [];
|
||||
}
|
||||
const runData = executionData.resultData.runData;
|
||||
|
||||
if (
|
||||
runData === null ||
|
||||
runData[node.name] === undefined ||
|
||||
!runData[node.name][runIndex].data ||
|
||||
!runData?.[node.name]?.[runIndex].data ||
|
||||
runData[node.name][runIndex].data === undefined
|
||||
) {
|
||||
return [];
|
||||
@@ -457,12 +453,7 @@ export const nodeHelpers = defineComponent({
|
||||
|
||||
const runData: IRunData | null = workflowRunData;
|
||||
|
||||
if (
|
||||
runData === null ||
|
||||
!runData[node] ||
|
||||
!runData[node][runIndex] ||
|
||||
!runData[node][runIndex].data
|
||||
) {
|
||||
if (!runData?.[node]?.[runIndex]?.data) {
|
||||
return [];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user