Cannot read properties of undefined (reading 'id') for collection

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.

I have the same problem!

Hey @avionics-saganist-94 :wave:t2:

Welcome to the Postman Community :postman:

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 :wave:t2:

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.

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