# “TypeError: undefined is not an object (evaluating 'x.y')”

> Safari and iOS say undefined is not an object (evaluating 'x.y') where Chrome says Cannot read properties of undefined. Find the missing value and guard it.

Canonical: https://app369.com/fix/undefined-is-not-an-object/
Last updated: 2026-11-08

An iPhone user, a Safari tester or a React Native app on JavaScriptCore reports TypeError: undefined is not an object (evaluating 'user.profile.name'), or null is not an object. It is the same mistake Chrome reports as Cannot read properties of undefined: the code read a property from a value that was undefined or null. The text in brackets shows the expression it was evaluating.

**Short answer**

Read the expression in brackets. In user.profile.name, the error means the part before the last dot (user.profile) was undefined. Find where that value comes from: usually data that has not loaded yet, an API response with a different shape, or an empty result from find() or an array index. Guard it with optional chaining (user.profile?.name) or a check, and render a loading state until the data arrives.

## **Why the value is missing, and the fix**

1. 01 ### **Data that has not loaded yet**
  > “You cannot invoke a method on an undefined or null variable.” [**MDN, TypeError: "x" is (not) "y"**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Unexpected_type) The first render runs before the fetch finishes, so the state is still undefined or null. Start from a value the code can read, and show a loading state until the real data arrives.```
const [user, setUser] = useState(null);

if (!user) return <Spinner />;
return <p>{user.profile?.name}</p>;
```
2. 02 ### **The API returned a different shape**
  > “To fix null pointer to undefined or null values, you can test if the value is undefined or null first.” [**MDN, TypeError: "x" is (not) "y"**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Unexpected_type) The code expects data.items, but the response is an error object, an empty body, or wraps the list in another key. Log the real response once, then read only what is there.```
const items = data?.items ?? [];
```
3. 03 ### **An empty result from find() or an index** find() returns undefined when nothing matches, and list[0] is undefined when the list is empty. Check the result before reading from it.```
const plan = plans.find((p) => p.id === id);
if (!plan) return null;
```
4. 04 ### **It only fails on iPhone or in React Native**
  > “Hermes is used by default by React Native and no additional configuration is required to enable it.” [**React Native, Using Hermes**](https://reactnative.dev/docs/hermes) The wording comes from JavaScriptCore, the engine in Safari and, in practice, in Chrome and other browsers on iPhone, and in React Native apps that opted out of Hermes. The cause is the same as in Chrome; the bug often shows up only there because of timing or a missing browser feature. Reproduce it in Safari with the Web Inspector open, or on the device.

Checked against the vendor’s docs on November 8, 2026: [MDN: TypeError: "x" is (not) "y"](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Unexpected_type); [React Native docs: Using Hermes](https://reactnative.dev/docs/hermes).

## **Rather hand it over?**

Fixed scope, fixed price, paid upfront. The work happens in writing; no call needed.

- [from $450**App Fix Ticket**One reproducible bug in an existing mobile or web app, diagnosed and fixed.**See scope and start**](https://app369.com/fixed-price/flutter-firebase-bug-fix/)
- [from $450**AI-Built App Rescue**A Lovable, Bolt or Cursor app checked end to end in 3 days, then its worst problems fixed at a fixed price.****No issues worth fixing, no charge.**** If the Launch Check finds nothing rated medium or higher, Simon refunds the full $450. You keep the report either way. This applies to the first 10 Launch Checks bought after October 30, 2026.**See scope and start**](https://app369.com/fixed-price/ai-app-rescue/)

Related: [**“Cannot read properties of undefined”**](https://app369.com/fix/cannot-read-properties-of-undefined/) · [**“Cannot convert undefined or null to object”**](https://app369.com/fix/cannot-convert-undefined-or-null-to-object/) · [**JavaScript “x is not a function”**](https://app369.com/fix/javascript-is-not-a-function/)

Questions

## **More on this error**

<details>

<summary>**Is this the same as Cannot read properties of undefined? **+</summary>

Yes. Safari and iOS phrase it as undefined is not an object (evaluating 'x.y'), Chrome, Edge and Node.js as Cannot read properties of undefined (reading 'y'), and Firefox as can't access property "y", x is undefined. The fix is the same.

</details>

<details>

<summary>**Why does it only happen on iPhone? **+</summary>

In practice, Chrome and other browsers on iPhone run on Safari’s engine (WebKit), so an iPhone user sees this wording even in Chrome. When the bug only appears there, look for code that depends on timing, a browser feature Safari lacks, or storage that is blocked in private browsing.

</details>

<details>

<summary>**Can you fix it for me? **+</summary>

If one bug is the whole problem, the App Fix Ticket covers it: a written diagnosis first, then the fix. If the app has more going on, the Launch Check is a written check of the whole app. Each issue found is rated critical, high, medium or low, with where it is and how it was confirmed. No issues worth fixing, no charge. If the Launch Check finds nothing rated medium or higher, Simon refunds the full $450. You keep the report either way. This applies to the first 10 Launch Checks bought after October 30, 2026.

</details>

A different error?

## **Describe it and get a written quote**

Send the error and what you were doing. You get a written scope, a fixed price and a timeline; Simon replies by email, usually within one business day.

[**Describe your problem **→](https://app369.com/contact/) [**All fixes**](https://app369.com/fix/)