Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading