Workflow Bug - Data Property Added

  1. My goal:
    Modifiying an API Result with a Code Block
  2. Issue:
    It Seems that the Query Block added Data Properties to an Array of Objects:
    the Structure that Comes back from the API is :
    [object, object] .. but when i inspect the result it seems that the workflow has modified it to : [{ data : object}, { data: object}]
  3. Steps I've taken to troubleshoot:
    None so far!
  4. Additional info: (Cloud or Self-hosted, Screenshots)
    Retool Cloud

Please advise ASAP as my workflow is Failing due to that!

Thanks


Hi @Martin_M . If I understand correctly, your data is being nested into an extra data object but you want it to just return a single array of objects so you can access it directly?

Sorry, just trying to make sure I understand the issue correctly

exactly, and it did work before, i haven't changed anything about the code.

also in the screenshots you see, when i go to "data" view the extra object isn't there, but in the json view it is. if i download the json, its also there.

I think the API response structure might have changed. Can you try to add a code step immediately after the query that does this:

return querystep.data.map(item => item.data ? item.data : item)

This checks whether each item is nested under data. If it is, it extracts the inner object; if not, it keeps the item as is. That way, you’ll always get the expected array format, and you can continue using it in your code.

Please let me know if this works for you

Hello,

The API structure has definetly not changed, as i still can request the data for example via Postman, and its not the same structure.

Sure i could add that block, but i assume that i'd have the same issue in many other workflows, as im working with the directus API, and the API always returns the same structure.

Kind regards & Many Thanks for your help tough!

Anyone from the Retool Workflow Team who can help with that?

Thks!

Hey @Martin_M - I'm not sure how this slipped through the cracks, but wanted to circle back and ask whether you still need any assistance!

What kind of resource are you working with? You kind of imply that it's a REST API query, but I'm not sure about that. Regardless, Retool should never modify the structure of the returned data so there is definitely something fishy going on.

Have you had a chance to revisit this, @Martin_M? Let me know if you have any additional questions!

hi darren,

Im sorry i cannot find the Workflow where it happend, but yeah it was a REST API Query. And it was modified by retool for sure. I have tested it with postman where the modification didnt appear.

1 Like

Just to be clear, though, this was a temporary issue that has since resolved itself?

Dear Darren, now i have a quite similar issue

The error still seems to be there, and interestingly happening for no good reason. Please let me know what you need to know, so we can figure this out!

Its a rest query to an API endpoint that by itself always delivers results in a data array.

I'd be interested in taking a look! Any screenshots of what you're seeing on that end would be helpful, along with the workflow ID.

Hi Darren,

its exactly the same issue as in my first posting .. retool seems to be creating data properties for some unknown reason.

workflow run id:
**019d778c-d622-7198-a7a2-96e4b6ea8f41
**
btw.. in the data view there are no β€œdata” properties per item, but in the JSON view they are here, and thats exactly the issue.

i hope you understand what the issue ist.

regards

Hey Darren, can you work with that?

Please let me know, thanks!

Thanks for sharing, @Martin_M. Just to clarify, are you making a single API query and getting back an array? Or are you querying the same endpoint multiple times in a loop?

I think I might know what's going on here and can do some additional testing on my end. Out of curiosity, is this a Query Library query? And what happens if you run the same query from within an app instead of a workflow?