# Firestore: “Function addDoc() called with invalid data. Unsupported field value: undefined”

> Firestore throws Unsupported field value: undefined when a field you save is undefined. Drop the field, use null, or turn on ignoreUndefinedProperties.

Canonical: https://app369.com/fix/firestore-unsupported-field-value-undefined/
Last updated: 2026-11-09

“Unsupported field value: undefined” is a Firestore SDK error for a write that includes a field set to undefined, which Firestore can’t store. The message names the field. Remove it, save null instead, or tell the SDK to skip undefined fields.

**Short answer**

Read the field name in the error, usually after “found in field”. Then find why it is undefined, often an optional form input or a missing API value. Leave the field out when it has no value, save null if you want an empty value stored, or set ignoreUndefinedProperties: true when you set up Firestore.

Rather not fix it yourself? [**App Fix Ticket**](https://app369.com/fixed-price/flutter-firebase-bug-fix/) starts with a fixed-price diagnosis, then a fixed price for the fix before any fix work.

## **Why the field is undefined, and the fix**

1. 01 ### **An optional field has no value**
  > “If set to false or omitted, the SDK throws an exception when it encounters properties of type undefined.” [**Firebase, FirestoreSettings.ignoreUndefinedProperties**](https://firebase.google.com/docs/reference/js/firestore_.firestoresettings) One undefined field makes the SDK refuse the whole write. setDoc and updateDoc refuse it the same way. In the Admin SDK the message reads “Cannot use undefined as a Firestore value”.
2. 02 ### **Leave out empty fields before saving** Strip undefined values from the object, or set the ones you want stored to null. This helper handles top-level fields only, so clean nested objects too if you have them.```
const clean = Object.fromEntries(
  Object.entries(data).filter(([, v]) => v !== undefined),
);
await addDoc(collection(db, 'orders'), clean);
```
3. 03 ### **Let the SDK skip them**
  > “If set to true, these properties are skipped and not written to Firestore.” [**Firebase, FirestoreSettings.ignoreUndefinedProperties**](https://firebase.google.com/docs/reference/js/firestore_.firestoresettings) Set the option once, before any other Firestore call, or initializeFirestore throws because Firestore already started. Test it with your data shape, since undefined values inside arrays may not be skipped.```
import { initializeFirestore } from 'firebase/firestore';

const db = initializeFirestore(app, { ignoreUndefinedProperties: true });

// Admin SDK (Node), before the first read or write
// import { getFirestore } from 'firebase-admin/firestore';
// getFirestore().settings({ ignoreUndefinedProperties: true });
```
4. 04 ### **The value really should be there** If the field must exist, skipping it hides a bug. Check the source: a typo in a property name, a value read before it loaded, or an API response missing a key.

Checked against the vendor’s docs on November 9, 2026: [Firebase reference: FirestoreSettings](https://firebase.google.com/docs/reference/js/firestore_.firestoresettings).

## **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/)

[**All 127 Fiverr reviews**](https://app369.com/reviews/)

Related: [**Firestore ALREADY_EXISTS**](https://app369.com/fix/firestore-already-exists-document/) · [**Firebase “Missing or insufficient permissions”**](https://app369.com/fix/firebase-missing-or-insufficient-permissions/) · [**Firestore query requires an index**](https://app369.com/fix/firestore-query-requires-an-index/) · [**Firebase Storage object-not-found**](https://app369.com/fix/firebase-storage-object-not-found/)

Questions

## **More on this error**

<details>

<summary>**Is null the same as leaving the field out? **+</summary>

No. null stores the field with an empty value, so queries on that field can match it. Leaving it out stores no field at all.

</details>

<details>

<summary>**Does the option change existing documents? **+</summary>

No. It only affects writes made after you set it. Fields already saved stay as they are.

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