Skip to content

Commit

Permalink
fix: Properly iterate over credentials with expressions (#8502)
Browse files Browse the repository at this point in the history
  • Loading branch information
krynble authored Jan 31, 2024
1 parent 39e8754 commit 0e9a5a2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion packages/core/src/NodeExecuteFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1714,6 +1714,7 @@ export async function requestWithAuthentication(
node: INode,
additionalData: IWorkflowExecuteAdditionalData,
additionalCredentialOptions?: IAdditionalCredentialOptions,
itemIndex?: number,
) {
let credentialsDecrypted: ICredentialDataDecryptedObject | undefined;

Expand All @@ -1738,7 +1739,7 @@ export async function requestWithAuthentication(
if (additionalCredentialOptions?.credentialsDecrypted) {
credentialsDecrypted = additionalCredentialOptions.credentialsDecrypted.data;
} else {
credentialsDecrypted = await this.getCredentials(credentialsType);
credentialsDecrypted = await this.getCredentials(credentialsType, itemIndex);
}

if (credentialsDecrypted === undefined) {
Expand Down Expand Up @@ -3000,6 +3001,7 @@ const getRequestHelperFunctions = (
credentialsType,
requestOptions,
additionalCredentialOptions,
itemIndex,
): Promise<any> {
return await requestWithAuthentication.call(
this,
Expand All @@ -3009,6 +3011,7 @@ const getRequestHelperFunctions = (
node,
additionalData,
additionalCredentialOptions,
itemIndex,
);
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1274,7 +1274,7 @@ export class HttpRequestV3 implements INodeType {
oAuth2Api = await this.getCredentials('oAuth2Api', itemIndex);
}
} else if (authentication === 'predefinedCredentialType') {
nodeCredentialType = this.getNodeParameter('nodeCredentialType', 0) as string;
nodeCredentialType = this.getNodeParameter('nodeCredentialType', itemIndex) as string;
}

const requestMethod = this.getNodeParameter('method', itemIndex) as string;
Expand Down Expand Up @@ -1714,6 +1714,7 @@ export class HttpRequestV3 implements INodeType {
nodeCredentialType,
requestOptions,
additionalOAuth2Options && { oauth2: additionalOAuth2Options },
itemIndex,
);
requestWithAuthentication.catch(() => {});
requestPromises.push(requestWithAuthentication);
Expand Down
1 change: 1 addition & 0 deletions packages/workflow/src/Interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,7 @@ export interface RequestHelperFunctions {
credentialsType: string,
requestOptions: OptionsWithUri | RequestPromiseOptions,
additionalCredentialOptions?: IAdditionalCredentialOptions,
itemIndex?: number,
): Promise<any>;

httpRequest(requestOptions: IHttpRequestOptions): Promise<any>;
Expand Down

0 comments on commit 0e9a5a2

Please sign in to comment.