Error: sandbox: execution interrupted, bridge disconnecting

Scenario:

Get-https://XXX/project/file/data/ProjectFileID/refresh

I need to loop this request (with some delay time 5 sec) until the status is processed in the response json.

Note 1: Status will be like first Processing and then Processed . If it is failed then it will be Error.

Note2: Loop should end when Status is Processed or Error .

Note 3 : Loop should continue when Status is in Processing .

For this i tried below script -Here i am getting error as Couldn’t evaluate the test script: Error: sandbox: execution interrupted, bridge disconnecting and tool is closing"

let status = “Processing”;
while (status === “Processing”) {
const delay = 20000;

  pm.sendRequest('Get-https://XXXX.com/api/v3/project/file/data/FileID',function(err,res){
      if (err) {
  console.error('Error:', err);
  return;
}
status = response.json().Status;
if (status === "Processed" || status === "Error") {
  console.log('Status:', status);
  return; // Exit the loop
}

});
}

Have a look at the following links.

web api testing - Postman - how to loop request until I get a specific response? - Stack Overflow

Retry a failing request - :person_raising_hand: Help - Postman Community

Both are similar in that they use a proper request in the GUI with setNextRequest instead of sendRequest.

They also recommend a max number of retries to ensure you can’t get an infinite loop.

Something you might want to consider.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.