I have a workflow set up with the following steps:
query snowflake
check query result for whether or not it has any data
When the query is successful the first time and doesn't time out, this workflow runs fine.
When the query fails due to a timeout the first time and retries, if the retry is successful it moves onto the next step, but that step fails because it thinks that the query "data" is null and it can't read the "length" property. Is there an issue with my setup here?
There doesn't seem to be an issue with your setup - not at first glance, at least. I did some simple testing and am unable to replicate the issue with basic JS blocks, but it could very well be a bug isolated to the resource query block or to the Snowflake data connector. When viewing the run history, what does the "Data" tab show as being returned by the searchForResults block?
Does the branch give any data back if you add in an optional chaining check on the data property searchForResults.data?.length > 0 (or in the Inputs tab of the node)?
I wonder if the retry is being reported back as an error even though it succeeds on the second pass.
This is a little bit mystifying, @whitney! I assume it continues to happen consistently and isn't just an intermittent bug?
I'm thinking of two potential workarounds you can implement while we get to the bottom of this:
Prevent the query from timing out in the first place! Easier said than done, given that you're on a cloud-hosted instance and unable to tweak things like timeouts beyond a certain point. You should be able to increase the timeout to 600000ms, though.
Move your query into a workflow function and invoke it from a JS code block! Using try...catch within a while loop would give you full control over error handling and should ensure we return the correct data after all is said and done.
Neither workaround is ideal but fortunately Retool provides some room for a little creativity! In the meantime, I am going to do a bit more work in order to hopefully reproduce this and get a fix in. I'll update you here as soon as possible!