Why can’t I delete large nodes in Firebase Realtime Database? (TRIGGER_PAYLOAD_TOO_LARGE) Firebase Realtime Database has a hard limit: if a write/delete operation would trigger a payload larger than 1MB (because triggers/events send the full data), it fails with TRIGGER_PAYLOAD_TOO_LARGE. This limit affects deletes via:
Changing settings like .settings/strictTriggerValidation or using service accounts does not bypass this.
What can you do?
async function deleteInBatches(path) {
const ref = admin.database().ref(path);
let snap = await ref.limitToFirst(100).once('value');
while (snap.exists()) {
const updates = {};
snap.forEach(child =\> updates\[child.key\] = null);
await ref.update(updates);
snap = await ref.limitToFirst(100).once('value');
}
await ref.remove(); // Optionally remove empty parent
}
If any individual child exceeds 1MB, this method will also fail.
No reliable way to force-delete huge single nodes If even a single child (or the node itself) is >1MB, there is no public method to delete it. No setting or permission will bypass this. This is a platform limitation by Firebase to protect against massive accidental deletes.
Contact Firebase support If you absolutely must delete such data (especially in production), open a support ticket with your project and path. In some cases, Firebase support can perform backend deletes not possible via public APIs.
Prevention tips Avoid storing large blobs in Realtime Database; use Cloud Storage. Keep your data shallow and well-partitioned.
Summary:
Chunked/batched deletes work if children are small enough. No workaround exists for single nodes/children >1MB—contact support.
References:
Firebase Functions limits (https://firebase.google.com/docs/functions/limits)