# \[Day 06 API Test\] TypeError: Cannot read properties of undefined (reading 'find')

**URL:** <https://community.postman.com/t/day-06-api-test-typeerror-cannot-read-properties-of-undefined-reading-find/45591>\
**Category:** Help Hub\
**Tags:** tests\
**Created:** [March 25, 2023, 4:29pm UTC](https://community.postman.com/t/day-06-api-test-typeerror-cannot-read-properties-of-undefined-reading-find/45591 "2023-03-25T16:29:35Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![chi.pham](https://avatars.discourse-cdn.com/v4/letter/c/9de053/32.png) [@chi.pham](https://community.postman.com/u/chi.pham)\
**Post date:** [March 25, 2023, 4:29pm UTC](https://community.postman.com/t/day-06-api-test-typeerror-cannot-read-properties-of-undefined-reading-find/45591/1 "2023-03-25T16:29:36Z")

</div>

**Your question may already have an answer on the community forum. Please search for related topics, and then read through the [guidelines](https://community.postman.com/t/about-the-just-getting-started-category/37) before creating a new topic.**

> Here’s an outline with best practices for making your inquiry.

_My question_:  
I get an error when learning. Does anyone help me with this?

_Details (like screenshots)_:

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/6/f/6f9f1914e9b43f50723067642e7418c3523da038.png)

_How I found the problem_:

_I’ve already tried_:

---

<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:** [March 27, 2023, 12:23pm UTC](https://community.postman.com/t/day-06-api-test-typeerror-cannot-read-properties-of-undefined-reading-find/45591/2 "2023-03-27T12:23:50Z")

</div>

You haven’t expanded the “API tests” folder, but I suspect its the spelling of one of the requests in that folder.

Therefore the “find” function in the test is failing.

---

<div class="post-metadata">

**Author:** ![chi.pham](https://avatars.discourse-cdn.com/v4/letter/c/9de053/32.png) [@chi.pham](https://community.postman.com/u/chi.pham)\
**Post date:** [April 3, 2023, 3:39pm UTC](https://community.postman.com/t/day-06-api-test-typeerror-cannot-read-properties-of-undefined-reading-find/45591/3 "2023-04-03T15:39:46Z")

</div>

Thank you for your information. I have resolved this error

---

<div class="post-metadata">

**Author:** ![vynk2310](https://avatars.discourse-cdn.com/v4/letter/v/3d9bf3/32.png) [@vynk2310](https://community.postman.com/u/vynk2310)\
**Post date:** [June 13, 2023, 2:28pm UTC](https://community.postman.com/t/day-06-api-test-typeerror-cannot-read-properties-of-undefined-reading-find/45591/4 "2023-06-13T14:28:11Z")

</div>

Hi @chi.pham , Can you help me to resolve this error ?

---

<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:** [June 13, 2023, 2:33pm UTC](https://community.postman.com/t/day-06-api-test-typeerror-cannot-read-properties-of-undefined-reading-find/45591/5 "2023-06-13T14:33:47Z")

</div>

@vynk2310

Is it just the “Tests added correctly” that is failing?

If so, this is usually because the name of the requests in the API tests folder aren’t exactly as detailed in the documentation.

Check that first, otherwise, please post a screenshot of the “API tests” folder.

---

<div class="post-metadata">

**Author:** ![vynk2310](https://avatars.discourse-cdn.com/v4/letter/v/3d9bf3/32.png) [@vynk2310](https://community.postman.com/u/vynk2310)\
**Post date:** [June 13, 2023, 2:39pm UTC](https://community.postman.com/t/day-06-api-test-typeerror-cannot-read-properties-of-undefined-reading-find/45591/6 "2023-06-13T14:39:35Z")

</div>

Hi @michaelderekjones , here’s my screenshot. I think the name of the request is correct :))

 ![Snag_596ed90](https://us1.discourse-cdn.com/getpostman/original/3X/a/2/a226fc525db7221c4e9dcfa8fb7cc5df8b86fd44.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:** [June 13, 2023, 3:38pm UTC](https://community.postman.com/t/day-06-api-test-typeerror-cannot-read-properties-of-undefined-reading-find/45591/7 "2023-06-13T15:38:09Z")

</div>

So you are having issues with Day 9. (Not day 06 as the main thread).

I suspect its the second “find” in the “variables set correctly” test.

All this is doing is returning the whole of the the code in the tests tab as a string.

Do you have any code in the tests tab for “get random user”?

If you have no code, then the find will error as it will be unable to find the “test” event.

It’s supposed to have code related to the setting of collection variables to be used in the Echo request.

---

<div class="post-metadata">

**Author:** ![chi.pham](https://avatars.discourse-cdn.com/v4/letter/c/9de053/32.png) [@chi.pham](https://community.postman.com/u/chi.pham)\
**Post date:** [June 14, 2023, 4:33pm UTC](https://community.postman.com/t/day-06-api-test-typeerror-cannot-read-properties-of-undefined-reading-find/45591/8 "2023-06-14T16:33:02Z")

</div>

It is the [Day 06] link [Postman](https://www.postman.com/security-candidate-52401847/workspace/api/collection/26484503-d45e9187-27fe-44a9-82a5-0416c1d8c987?action=share&creator=26484503)  
Hope you can find the different

---

<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:** [June 15, 2023, 10:56am UTC](https://community.postman.com/t/day-06-api-test-typeerror-cannot-read-properties-of-undefined-reading-find/45591/9 "2023-06-15T10:56:30Z")

</div>

@chi.pham

Sorry, my response was to the latest message from @vynk2310, not your original question related to day 6.
