Tests script running Error: sandbox: execution interrupted, bridge disconnecting

Hi, All

I am new to Postman. I have the following Tests code in my Post request:

pm.test(“Status code is 200”, function () { pm.response.to.have.status(200); });

After I sent the request, I got expected response. But I got the following error in Test Results:

There was an error in evaluating the test script: Error: sandbox: execution interrupted, bridge disconnecting.

Interesting thing is I had the same code in the previous Get request and the error didn’t happen in that step.

I searched online and could not find any solutions. Is there anyone can help to give a solution? Thanks for help.

Hello! Any update on this issue? I am receiving the same error in a script where I am waiting for 2 minutes (purposefully) at the end of my test script. Is there a request timeout setting in postman that I need to change?

Hello @chrisallemang, welcome to the community! :wave:

The test script is perfectly fine and doesn’t seem to error out.

pm.test("Status code is 200", function() {
    pm.response.to.have.status(200);
});

The error - Error: sandbox: execution interrupted, bridge disconnecting , generally happens when there’s a part of the script that is non-terminating or has some memory overflow issue around it.
For eg, there might be some infinitely running while/for loop.

To debug, you can comment all the parts of your script and just run this test to see if it works or not, and then you can drill down to the line which might be causing this issue.

Hello @sivcan! Thanks for the response. If I remove the following few lines, I the script runs just fine. To be clear, the request still executes but the response throws the error.

console.log(“Sleep for 3 minutes to let video transcode”);
var t = new Date().getTime();
while (new Date().getTime() < t + 180000);
console.log(“Done sleeping”);

This was working 2 days ago. Is there a different way that I can sleep after this request?

@chrisallemang - I am not sure why it was working before, but I do know that a synchronous operations will end after 30 seconds (That is the internal limit).

So, instead of going with the synchronous approach to halt the script you can go with the asynchronous way to halt the script using setTimeout for a much larger amount of time.

For eg:

setTimeout(() => {
    // Write your logic here 
    pm.test('This test will pass after 20 seconds');
}, 20000);
1 Like

@sivcan, thank you! That worked perfectly.

1 Like