There is a strange issue Iโm getting when running a collection using newman.
This one request has a retry mechanism in its post-script
if (response.id == null)
{
let retryCounter = pm.environment.get("retryCounter")
let currentRun = pm.environment.get("currentRun");
if (parseInt(currentRun) <= parseInt(retryCounter))
{
pm.execution.setNextRequest("userTask - personal data 1")
}
else{
pm.execution.setNextRequest(null)
throw new Error("Polling unsucessful. ID is null or same as in previous step")
}
pm.environment.set("currentRun", parseInt(currentRun) + 1)
}
else
{
pm.execution.setNextRequest("Submit - personal data")
}
But the problem Iโm getting is that newman reports a โtype-script error in test scriptโ
Upon looking at the newman report I see
Cannot read properties of undefined (reading 'setNextRequest')
Seems setNextRequest is not available from an if loop? So it seemsโฆwhy?