Hi,
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?
JJ
That test is not causing the issue.
Check the āPre-requestā and āPost-responseā scripts on the request, the folder and collection. There must be code somewhere causing this.
Hey @avionics-saganist-94
Welcome to the Postman Community
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 ended up reinstalling the application and it worked
Hello Danny, When I try to run my collection this message appears. Cannot read properties of undefined (reading āidā)
What Collections are you running and in what context?
Are you following some training or using the Postman API?
Is there a script thatās doing something with the data?
Same error issue as above issue I have from past week , I have to restart the system then it works
Hey @darshpreetsingh
Can you elaborate more on the workflow that you have in your context?
If this is an issue that more people are having, understanding the pattern or similar actions will help us in providing support.
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
@darshpreetsingh
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.
The First Api itself does not even gets executed in this case
Is there a pre-request script for the first request?
Do you have any scripts using a variable called āidā?
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
For what it is worth, when I had my issue, I have absolutely no reference to id anywhere and a reinstall was needed to fix the issue
1 Like
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.
Hi @danny-dainton,
I faced the same error, to answer a little bit to your previous questions:
āCan you elaborate more on the workflow that you have in your context?ā, Iām using the Atlassianās API collection and tried to run this API https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-groups/#api-rest-api-3-group-user-delete.
Iām using a few variables that were all correctly defined in the CSV I uploaded. No Pre/post-scripts either.
After I closed Postmanās Desktop app, and ended all itās background tasks and re-launched it, the same Run worked correctly.
Hope this helps.