fix: Resolve expressions in credentials following paired item (#8250)

## Summary
Fixes the issue that pairedItem information was not available in
expressions that got used in credentials


## Related tickets and issues

[PAY-1207](https://linear.app/n8n/issue/PAY-1207/paireditem-expressions-not-working-correctly-in-credentials)


## Review / Merge checklist
- [x] PR title and summary are descriptive. **Remember, the title
automatically goes into the changelog. Use `(no-changelog)` otherwise.**
([conventions](https://github.com/n8n-io/n8n/blob/master/.github/pull_request_title_conventions.md))
- [ ] [Docs updated](https://github.com/n8n-io/n8n-docs) or follow-up
ticket created.
- [ ] Tests included.
> A bug is not considered fixed, unless a test is added to prevent it
from happening again.
   > A feature is not complete without tests.

---------

Co-authored-by: Omar Ajoue <krynble@gmail.com>
This commit is contained in:
Jan Oberhauser
2024-01-08 10:48:20 +01:00
committed by GitHub
parent 008fd5a917
commit ccb2b076f8
7 changed files with 56 additions and 39 deletions

View File

@@ -32,6 +32,7 @@ import type {
INodeTypes,
IWorkflowExecuteAdditionalData,
ICredentialTestFunctions,
IExecuteData,
} from 'n8n-workflow';
import {
ICredentialsHelper,
@@ -339,6 +340,7 @@ export class CredentialsHelper extends ICredentialsHelper {
nodeCredentials: INodeCredentialsDetails,
type: string,
mode: WorkflowExecuteMode,
executeData?: IExecuteData,
raw?: boolean,
expressionResolveValues?: ICredentialsExpressionResolveValues,
): Promise<ICredentialDataDecryptedObject> {
@@ -358,6 +360,7 @@ export class CredentialsHelper extends ICredentialsHelper {
decryptedDataOriginal,
type,
mode,
executeData,
expressionResolveValues,
canUseSecrets,
);
@@ -371,6 +374,7 @@ export class CredentialsHelper extends ICredentialsHelper {
decryptedDataOriginal: ICredentialDataDecryptedObject,
type: string,
mode: WorkflowExecuteMode,
executeData?: IExecuteData,
expressionResolveValues?: ICredentialsExpressionResolveValues,
canUseSecrets?: boolean,
): ICredentialDataDecryptedObject {
@@ -412,7 +416,7 @@ export class CredentialsHelper extends ICredentialsHelper {
expressionResolveValues.connectionInputData,
mode,
additionalKeys,
undefined,
executeData,
false,
decryptedData,
) as ICredentialDataDecryptedObject;
@@ -579,6 +583,7 @@ export class CredentialsHelper extends ICredentialsHelper {
credentialType,
'internal' as WorkflowExecuteMode,
undefined,
undefined,
user.hasGlobalScope('externalSecret:use'),
);
} catch (error) {