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

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?

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.)

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

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!

1 Like

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.