Troubles passing data via IF and MERGE and Google Drive Nodes

Describe the problem/error/question

Hey everyone! I am having weird issues with data flow using Google Drive, If, and Merge nodes. I am using a webhook trigger from Click Up to create a file structure on a google drive for storing customer information. The file structure is intended to be as shown:

Customer Files
-Year
–Q1
—Customer Name
----Invoice #1
-----Art
-----Quote
-----Mockup

I’ve had varying degrees of success getting the information to pass as needed, but ultimately, this is not working as intended to cover the situations where a folder exists but needs to be in a different sub folder, etc. (From the example photo a customer could have multiple Invoice folders that would each have their own art / quote / mockup.)

I think I have tracked the problem to the IF nodes and destroying data depending on the output result. As the workflow is right now, I am using a “Google Drive Search Files and Folders” node to first check to see if the wanted folder exists, first for the formatted year, then quarter for that year, etc. Using the payload from the Click up webhook, I check to see if the customer name exists. Next an IF node checks to see if the Googe Drive node returned an empty value (IF-True Path), or returns a google drive folder ID and the name. If not (If-False) path it moves to a Google Drive node that creates the folder using the payload name from the webhook.

This is the point where it stops working. If I tell the IF to always pass data, it will continue to create a path back to the webhook (which I need for the file structure) making it always send data on the true path. If the false path is used the folder is created, as intended. When I send both streams into the MERGE node, all I return after that is the id and name of the created folder. All other previous data is empty (the nodes are listed on the left, but they are empty.

CustRung



There is no error message. The workflow just doesnt create the folders, or it will create an untitled folder in the root drive because it didnt get the proper folder ID from previous nodes due to this issue. How do I get around, or fix the issue of my datastream becoming essentially filtered by the IF node? If the node returns TRUE, it will pass the previous data as expected.

In my mind, it should look more like:


With a path back to all previous nodes.

  • n8n version: 1.59.4
  • Database (default: SQLite): Sqlite
  • n8n EXECUTIONS_PROCESS setting (default: own, main): regular
  • Running n8n via (Docker, npm, n8n cloud, desktop app): docker, self-hosted
  • Operating stem: unknown

OMG, this has been driving me nuts for two day as well, I have a big workflow and at some point I have an IF that checks if the file passed is a PDF, if TRUE I then have an HTTP Request node that downloads the file into memory, next step is a google drive node to upload the file to a folder, I download the file and when I proceed to the next node to test it and press on test step everything checks green but the google drive node has no output data!

Screenshot 2024-09-25 at 08.44.27

Workflow: Cannot paste it as it exceeds the max body size of 32K Chars

Any idea how to get around this @poorKiwi ?

I figured it out, this is not the same issue that you’re facing my issue has to do with how the data field is mapped downstream of a node and due to the fact that I am merging two HTTP nodes into one google drive node

Not sure you need the Merge-node at all. Since the If-node should route to only one of its output paths, what follows would never be merging inputs from multiple paths… ever. See if it works like this.

I think you are right. I removed the Merge nodes, and its behaving more as I expected. Though, as the discussion goes in the discord, now I am having to reference items directly as in {{ $(‘Node Name’).first().json.id }} rather than just {{ json.id }}. I think I just dont understand how merge should be used, or there is still some other issue that I havent tracked down yet.

In the end, the solution was to remove the MERGE nodes and just tie both outputs of the IF to the next node.

using MERGE created an undefined entry in the data stream which ultimately lead to an overwrite of the data from whatever output computed last ie: IF-TRUE would pass and allow a path back to the nodes previous, but then IF-FALSE would evaluate, and only pass the node after that and an undefined value. it was weird, but I chalk it up to inexperience :slight_smile:

1 Like

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