Workflow block does not get a string parameter from a previous block

Hello there!

I'm currently facing a weird problem related with a MongoDB find-query block. For putting the entire context, I'm running an automated workflow via an external trigger.

Let's say that I have a 1st MongoDB block named "getUserId" whose output is just a string, therefore the way I would capture this information into another subsequent block is by calling "{{getUserId.data}}". The query done is bringing the results flawlessly.

Then, when I connect this block with a 2nd block named "getAssetReport" (which would be the MongoDB query that I am looking for), the query is giving NO RESULTS AT ALL, even though the parameters of the query field are passed correctly and those work well when I manually single-run the block by pressing the blue Run button.

I've tried as many deploys as possible for a couple of days. No problems with the database exist whatsoever, nor even the trigger itself which runs perfectly.

Here is a screenshot of the evaluated query expression inside "getAssetReport" block. This evaluated expression picks up the result from the previous block and then it converts it into the valid string:

Then this is the output given by the block itself. Simply Empty:

Again, if I enter this string result manually and do the Block Run, it works perfectly. It's as if the 2nd MongoDB block is being blocked by Retool itself since the 1st one works very well. There is not Error Throwing at all, just an empty data that Retool is sending in the find-query.

Last but not least, I did duplicated the 1st block and connected it afterwards. The thing is that is as Retool is not allowing me to execute a 2nd query automatically, even though the collections and database are not that heavy.

Do you guys could figure out what would be the cause of this? I'm out of options.

Thanks beforehand for your support!

Hi @Pedro_German, welcome to the forum! :wave:

Do you mind sharing a screenshot of both blocks?

Hi @Paulo

Thanks for the reply! Here are both blocks, which run perfectly when I single-run them.

First block:

Second block:

Since every block possesses the same database configuration, both of them extracts their respective information, so no problem related with the database query should exist.

Could be another way of implementing those blocks as separated JS Query or endpoints in any case? Maybe it's due to Retool platform problems.

We shouldn't be able to have two blocks with the same name but I'm guessing we recreated the query on the same block just to share the setup. I would love to see how these blocks are connected, feel free to send it in a DM if you prefer.

The only reason I see this happening is if these blocks are running independent from each other, the second block would be running before the data property of the first one is populated.

We could make two REST API Function queries, for example:

One function to make the first request:

And another one for the second request:

Then use one JS block to run the second one with the output of the first one:
Screenshot 2024-08-30 at 5.12.22 PM

1 Like

@Paulo many thanks! At first I did something similar by writing the connections in JavaScript. I set a async function for their responses one by one, then I connected the results and I also made sure to increase the timeout time, as well as the retry counts.

Then I try this approach for code simplicity purpose and it works very well. Thanks for the help!

1 Like

You are welcome! Happy building. :hammer_and_pick: