But I need to put the GET into a function block so I can re-try until I receive a specific status in the 200 response (at least as I understand it from spending time going through other posts). However, when I do that, I can't seem to pass the variable to create the URL correctly:
The error code says: {"data":null,"error":"(line 5) Error: {"error":{"code":"NotFound","message":"Resource not found.","innererror":{"code":"OperationNotFound","message":"The requested operation was not found. The identifier may be invalid or the operation may have expired."}}}"}
The function is an import of the same GET query defined in the App and works if I test it with a string
I - and others - are having a similar issue but no word yet from Retool. Can someone from Retool at least chime in to say that they are looking into this critical bug!
Yes - needed the parameter. I had not done this because the UI shows it as an error when you do:
Thanks for the heads-up on the built-in retry, but I'm not using it since it only works in the event I get an actual 400-type error and I need to retry based on the status returned in a 200-type response.
@Tess - can you surface the "Hard Error" tooltip which is actually a "Stern(?) Warning" to the Dev team to review? I'm sure I'm not the only one who would be thrown off by it.
I'm leveraging code from Retry API call? that retries [n] times (10 in the example below) and then throws an error. Thanks for the alternate approach as well.
const var= "some parameter";
const maxTries = 10; // how many times should we retry
for (let i = 0; i < maxTries; i++) {
const result = await functionForGET(var); // try to run the function(*params*)
if (result.data.state === "running") { // set response that triggers repeat
await new Promise((r) => setTimeout(r, 10000)); // if met try again
continue; // otherwise move on
}
return result;
}
throw new Error("Max tries reached"); // Uh-oh. Tried [n] times and it didn't work