🐛 Fix bug with expressions in credentials

This commit is contained in:
Jan Oberhauser 2021-01-26 16:52:35 +01:00
parent 353a270f0c
commit bd4639b644

View file

@ -136,7 +136,11 @@ export class CredentialsHelper extends ICredentialsHelper {
if (expressionResolveValues) {
try {
decryptedData = expressionResolveValues.workflow.expression.getParameterValue(decryptedData as INodeParameters, expressionResolveValues.runExecutionData, expressionResolveValues.runIndex, expressionResolveValues.itemIndex, expressionResolveValues.node.name, expressionResolveValues.connectionInputData) as ICredentialDataDecryptedObject;
const workflow = new Workflow({ nodes: Object.values(expressionResolveValues.workflow.nodes), connections: expressionResolveValues.workflow.connectionsBySourceNode, active: false, nodeTypes: expressionResolveValues.workflow.nodeTypes });
// TODO: Find a better way for that!
// Add the credential data to the parameters of the node so that they can get accessed by expressions
Object.assign(workflow.nodes[expressionResolveValues.node.name].parameters, decryptedData);
decryptedData = workflow.expression.getParameterValue(decryptedData as INodeParameters, expressionResolveValues.runExecutionData, expressionResolveValues.runIndex, expressionResolveValues.itemIndex, expressionResolveValues.node.name, expressionResolveValues.connectionInputData) as ICredentialDataDecryptedObject;
} catch (e) {
e.message += ' [Error resolving credentials]';
throw e;