Loop Block Returning error with it's template code

Hi Team,

I have a workflow that is: grabbing a list of products to grab from postgres DB -> looping through those products and grabbing the full data from an API -> modifying API data with JS -> uploading modified data back to API -> uploading data into another DB.

At the 'uploading modified data back to API step' am running into an error with the loop block. My intension is to get all the data modified back into the api with the updates but the API has restrictions (can't seem to do this in a bulk upload so am trying a loop block to do it one by one). The error getting returned is from the loop's built in object:
[info] Error evaluating writeProducts_lambda: {"message":""}

The only change I've made to the loop's default GUI template is adding 'await' as the API seems to error (can only handle one request at a time) and I don't believe this is impacting the rest of the query.

Below is also the prior query of the data trying to get imported back into the API if it is of any help:

Thanks in advance, I have the feeling it is something small that I've completely missed but can't seem to solve it.


Hey Tom, I apologize for the delay in getting back to you, and I'd be happy to help with this!

Quick question. Do you know if any of the values getting passed into the loop are null or undefined? e.g. value.selling_price isn't actually evaluating to a value

Hi Victoria,

No worries, appreciate the response.

I am as certain as I can be that the values getting passed into the loop are not null or undefined. I have a JS block before it refining all the results down to what I want to process. Have double checked that selling_price is correctly referred.

The problem has since evolved, the original issue is I couldn't write at all to the API (since I wasn't exactly sure on the formatting) and the error issue was throwing out what I thought was correct.

Now I have the entire process working perfectly when I run the workflow blocks individually, however when it comes to scheduling it automatically, it fails on the same error as the block in the original post.

It is almost as if caching is somehow getting in the way, im not too experienced so I am a little lost.

Thanks in advance!

I'm having this same issue!

Hmm definitely strange! The fact that this works when run as a block vs as a whole might indicate an auth issue. Is there any auth setup for your APIs? Out of curiosity, could you try setting a delay to make sure the values are all present before the loop starts?

Not quite sure what you mean but I will try to explain.

There is auth required for the API's however I believe this is set up correctly (works in block format and has worked for writing to the API in the past as well).

In the loop block I have added 'await' to the code to wait for every result/api call to finish before continuing on with the next one.

I will note that this issue has popped up in the past with other API's, unrelated to this one, when using the loop block. They did end up fixing themselves when nothing else was done to the code, just kind of trying again every couple of days. That is why i suspect something is going wrong in the background. I have tried again today and am still getting the same error

Hi @tomrezoando,

Thanks for these details! I believe Victoria was asking about the auth because we are tracking an issue where some authentication only works when a user manually runs the blocks versus running the workflow as a whole. See more details being discussed here

What is the auth method? Are you using shared credentials for your auth?

Does this sound like the same issue for you, @Massimo_Carbone