Merge Node Only Outputting 1 Instead of 2 Items

Greetings all!

I have set whereby;

1.Every 45 Minutes a cron Trigger runs to fetch an access token via HTTP that’s forwarded to Set-Node (access_token)
2.Every other minute or so a Gravity Forms Trigger Node (Community Node) listens for an input that’s forwarded to Set-Node (transaction_id)

I want to merge the 2 & have the Merge node output 2 items everytime regardless of whether they’re coming at the same time
i.e use the last access-token gotten plus the new transaction id every x-minutes

the problem I’m getting on an active workflow however is only one item goes through (transaction_id)
& it ignores the access_token

I’ve set Merge node to “Combine”
but I’m guessing that’s not the way to get through this, kindly advice.

(screenshot of active workflow execution)

int he case where I set Merge Node to “Append” I get an “undefined” on one (it brings the output on 2 rows instead of on

e.g is there a way to “cache” the access_token up until it’s refreshed say, using a Funstion Node maybe?

If both of your branches output only one item each, use the “Merge by position” setting, or even the Multiplex

image

Using the append, it just append the two items with each having own values. That’s why you got empty columns on both.

but I’d still have the problem of one item output from the merge node since the triggers run at different times
e.g the transacton_id from GF Trigger will find the access_token value empty

I suppose my question here would be how do I save/cache the access token for 45 minutes so it can be used i the Merge node before it’s refreshed?

The way your workflow is arranged it will never output the merge node, as each trigger will only output to one branch in different executions.

You have to create a separate workflow to store the token into an external database or subscribe to a n8n pro plan and store into a global variable.

Your main workflow must retrieve the token from the place you stored them and them you can merge it.

I managed to find a solution by 1st saving the token on a Postgres workflow then fetching it on the 2nd workfow

4 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.