# Getting TypeError " Cannot read properties of undefined (reading 'employee\_name')"

**URL:** <https://community.postman.com/t/getting-typeerror-cannot-read-properties-of-undefined-reading-employee-name/42237>\
**Category:** Help Hub\
**Created:** [December 20, 2022, 4:33pm UTC](https://community.postman.com/t/getting-typeerror-cannot-read-properties-of-undefined-reading-employee-name/42237 "2022-12-20T16:33:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mohandpc0125](https://avatars.discourse-cdn.com/v4/letter/m/a87d85/32.png) [@mohandpc0125](https://community.postman.com/u/mohandpc0125)\
**Post date:** [December 20, 2022, 4:33pm UTC](https://community.postman.com/t/getting-typeerror-cannot-read-properties-of-undefined-reading-employee-name/42237/1 "2022-12-20T16:33:48Z")

</div>

Hi All,

I am getting the below issue once I run the collection for the multiple set of data (Users.csv).

End Point: [dummy.restapiexample.com/api/v1/employees](http://dummy.restapiexample.com/api/v1/employees)  
HTTP Method: GET

# Code:

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

});

pm.test(“Response time”, function(){  
pm.expect(pm.response.responseTime).to.be.below(4000)

});  
const auth = undefined;  
console.log(auth?.employee\_name); // undefined  
console.log(auth?.employee\_name?.employee\_name);

pm.test(“Verify login user”, function() {

```
const response = pm.response.json();

pm.expect(response.json.employee_name).to.eql(pm.iterationData.get("Emp_Name"));
pm.expect(response.json.employee_salary).to.eql(pm.iterationData.get("Emp_Salary"));
pm.expect(response.json.employee_age).to.eql(pm.iterationData.get("Emp_Age"));

```

});

# Error:

Verify login user | TypeError: Cannot read properties of undefined (reading ‘employee\_name’)

Please assist on resolving this issue.

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/e/b/ebfc428f0f78bcd2cb5a1c8d1c983a3b66c34a16.png)

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [December 20, 2022, 5:14pm UTC](https://community.postman.com/t/getting-typeerror-cannot-read-properties-of-undefined-reading-employee-name/42237/2 "2022-12-20T17:14:03Z")

</div>

What is is this doing?

```auto
const auth = undefined;
console.log(auth?.employee_name); // undefined
console.log(auth?.employee_name?.employee_name);

```

This isn’t what is causing your problem, but I can’t work out what is actually doing.

The problem is with your assertion.

```auto
pm.expect(response.employee_name).to.eql(pm.iterationData.get("Emp_Name"));

```

You’ve already parsed the response. You haven’t included an example response but I’m going to guess that it should be response.employee\_name.

The error is reporting back as undefined as it can’t find the value.

---

<div class="post-metadata">

**Author:** ![mohandpc0125](https://avatars.discourse-cdn.com/v4/letter/m/a87d85/32.png) [@mohandpc0125](https://community.postman.com/u/mohandpc0125)\
**Post date:** [December 20, 2022, 5:46pm UTC](https://community.postman.com/t/getting-typeerror-cannot-read-properties-of-undefined-reading-employee-name/42237/3 "2022-12-20T17:46:45Z")

</div>

Hi mdjones,

Thank you so much, it got resolved I have updated the assertion which you have provided. It is working now.

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/2/c/2c3fddafbcaab9e24fd73447fe4779fa7c7d1b25.png)
