I am trying to run a collection but before it hits any request, an error comes up saying
Failed running the collection: TypeError: Cannot read properties of undefined (reading 'id')
My only test is
pm.test("Status code is 200", function () {
pm.response.to.have.status(200);
});
The collection runs were working previously and nothing has changed. Why has it stopped working? I can run each request individually. If I restrict the collection run to a single request, it still does not work. What is happening?
Your context is more than likely different, it would be better to fully explain your own issue, the workflow or any other relevant information so that we can help you better here.
I have set of APIS which have pre requests and post request and that set variables taken from response to get used in following apiās but when running a folder from collection it gives the mentioned error however if I run same folderās request one by one in sequence then no errors. Issue Resolved after 2 times of restarting system
If the problem is intermittent and a reboot sorts it, then I can only suggest adding extra console logging to your scripts to work out where the error is happening.
The error is likely to be before the actual line that is generating the error.
A required variable is returning undefined, so you need to track down the part of the code that generates that variable to investigate.
If you set a collection or environment variable. Console log it straight afterwards to ensure its been set.
no pre request in the first api only have post request to set variables and in request body I use some variables that are set on collection level already
Just adding to this. I had the exact same issue and error and found this page. Restarting Postman triggered yet another firewall rule prompt and my runner worked fine afterwards with no changes to anything else. Desktop app on win10 had been open for less than a day. I didnāt need to reinstall, but is it possible that the constantly changing firewall signature is part of the issue? Almost every time i start postman recently i get asked to make a new rule by windows.