Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

122
Views
Firestore recursiveDelete call stack exceeded

I am attempting to delete all subcollections of a firestore document in React Native, using the firebase cloud functions recursiveDelete() method. When the function is called, it fails with

[Unhandled promise rejection: RangeError: Maximum call stack size exceeded.]
at [native code]:null in map
at [native code]:null in map
.
.
.
at [native code]:null in map

There is very little documentation on this function, in fact, it is not even mentioned in the official firebase docs. It is only documented here https://googleapis.dev/nodejs/firestore/4.15.1/Firestore_.html#recursiveDelete. People from this discussion seemed to have success with this function.

I implemented my function following the documentation's instructions, so this error confuses me, especially since I was under the impression the entire point of this function was to avoid exceeding the maximum call stack size.

This is my cloud function that calls recursiveDelete():

exports.deleteSubs = functions.https.onCall(async(data, context)=>{
    await firestore.recursiveDelete(data.path)
})

and the front-end code which calls the cloud function

var functions = firebase.functions()
let deleteFn = functions.httpsCallable('deleteSubs');

let ref = db.collection("Posts").doc(post.key)
deleteFn({path: ref})

This error occurs with and without the optional bulkWriter included in the docs example.

It also fails on documents with no nested subcollections (which makes me confused on how the stack size is being exceeded).

I have verified that the path being passed in is correct.

about 4 years ago · Santiago Gelvez
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!