# REGISTRATION: undefined is not an object (evaluating 'response.ok')

**URL:** <https://forum.codewithmosh.com/t/registration-undefined-is-not-an-object-evaluating-response-ok/2412>\
**Category:** React Native\
**Created:** [February 2, 2021, 4:57pm UTC](https://forum.codewithmosh.com/t/registration-undefined-is-not-an-object-evaluating-response-ok/2412 "2021-02-02T16:57:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tt703](https://avatars.discourse-cdn.com/v4/letter/t/a6a055/32.png) [@tt703](https://forum.codewithmosh.com/u/tt703)\
**Post date:** [February 2, 2021, 4:57pm UTC](https://forum.codewithmosh.com/t/registration-undefined-is-not-an-object-evaluating-response-ok/2412/1 "2021-02-02T16:57:53Z")

</div>

In the authentication section in lesson 17 (Part 2), I am getting this error when pressing register. Double checked the code with the uploaded one. What could be the cause?

 ![Screenshot 2021-01-30 at 10.49.44 PM](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/1X/8b6aa5afc3757daad3391679378438aca3c344c6.jpeg)

---

<div class="post-metadata">

**Author:** ![dpickut](https://avatars.discourse-cdn.com/v4/letter/d/a87d85/32.png) [@dpickut](https://forum.codewithmosh.com/u/dpickut)\
**Post date:** [February 5, 2021, 2:50pm UTC](https://forum.codewithmosh.com/t/registration-undefined-is-not-an-object-evaluating-response-ok/2412/2 "2021-02-05T14:50:56Z")

</div>

As a fellow student, I share your frustration with the “undefined is not an object” message. I’ve spent hours resolving those.

In the handleSubmit event handler, the custom hook useApi.js gets called via registerApi.

Maybe check the code in the custom hook useApi.js? (And, make sure your backend server is working – although, if not I’d think a different error should have been returned.)

---

<div class="post-metadata">

**Author:** ![tt703](https://avatars.discourse-cdn.com/v4/letter/t/a6a055/32.png) [@tt703](https://forum.codewithmosh.com/u/tt703)\
**Post date:** [February 14, 2021, 11:13am UTC](https://forum.codewithmosh.com/t/registration-undefined-is-not-an-object-evaluating-response-ok/2412/3 "2021-02-14T11:13:09Z")

</div>

UPDATE: I switched the simulator from iphone 11 pro to iphone 11 and I’m no longer getting the error…

---

<div class="post-metadata">

**Author:** ![dpickut](https://avatars.discourse-cdn.com/v4/letter/d/a87d85/32.png) [@dpickut](https://forum.codewithmosh.com/u/dpickut)\
**Post date:** [February 14, 2021, 7:10pm UTC](https://forum.codewithmosh.com/t/registration-undefined-is-not-an-object-evaluating-response-ok/2412/4 "2021-02-14T19:10:13Z")

</div>

Good job! But I share the frustration with this type of issue. It seems like there are just some bugs in the overall integration of Xcode simulator, Expo, etc. As students, we end up spending hours on problems like this – wasting learning time!

---

<div class="post-metadata">

**Author:** ![connorm12](https://avatars.discourse-cdn.com/v4/letter/c/6a8cbe/32.png) [@connorm12](https://forum.codewithmosh.com/u/connorm12)\
**Post date:** [June 29, 2023, 5:14pm UTC](https://forum.codewithmosh.com/t/registration-undefined-is-not-an-object-evaluating-response-ok/2412/5 "2023-06-29T17:14:47Z")

</div>

This is old, but for anyone who has this problem in the future, dpickut’s suggestion of checking useApi.js solved my problem. Double check that your useApi.js file is exactly the same as mosh’s useApi.js file at the end of the authentication section.
