fix: Properly iterate over credentials with expressions (#8502)

This commit is contained in:
Omar Ajoue 2024-01-31 12:12:18 +00:00 committed by GitHub
parent 39e8754784
commit 0e9a5a2ab2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 2 deletions

View file

@ -1714,6 +1714,7 @@ export async function requestWithAuthentication(
node: INode,
additionalData: IWorkflowExecuteAdditionalData,
additionalCredentialOptions?: IAdditionalCredentialOptions,
itemIndex?: number,
) {
let credentialsDecrypted: ICredentialDataDecryptedObject | undefined;
@ -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) {
@ -3000,6 +3001,7 @@ const getRequestHelperFunctions = (
credentialsType,
requestOptions,
additionalCredentialOptions,
itemIndex,
): Promise<any> {
return await requestWithAuthentication.call(
this,
@ -3009,6 +3011,7 @@ const getRequestHelperFunctions = (
node,
additionalData,
additionalCredentialOptions,
itemIndex,
);
},

View file

@ -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;
@ -1714,6 +1714,7 @@ export class HttpRequestV3 implements INodeType {
nodeCredentialType,
requestOptions,
additionalOAuth2Options && { oauth2: additionalOAuth2Options },
itemIndex,
);
requestWithAuthentication.catch(() => {});
requestPromises.push(requestWithAuthentication);

View file

@ -721,6 +721,7 @@ export interface RequestHelperFunctions {
credentialsType: string,
requestOptions: OptionsWithUri | RequestPromiseOptions,
additionalCredentialOptions?: IAdditionalCredentialOptions,
itemIndex?: number,
): Promise<any>;
httpRequest(requestOptions: IHttpRequestOptions): Promise<any>;