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

View file

@ -1274,7 +1274,7 @@ export class HttpRequestV3 implements INodeType {
oAuth2Api = await this.getCredentials('oAuth2Api', itemIndex); oAuth2Api = await this.getCredentials('oAuth2Api', itemIndex);
} }
} else if (authentication === 'predefinedCredentialType') { } 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; const requestMethod = this.getNodeParameter('method', itemIndex) as string;
@ -1714,6 +1714,7 @@ export class HttpRequestV3 implements INodeType {
nodeCredentialType, nodeCredentialType,
requestOptions, requestOptions,
additionalOAuth2Options && { oauth2: additionalOAuth2Options }, additionalOAuth2Options && { oauth2: additionalOAuth2Options },
itemIndex,
); );
requestWithAuthentication.catch(() => {}); requestWithAuthentication.catch(() => {});
requestPromises.push(requestWithAuthentication); requestPromises.push(requestWithAuthentication);

View file

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