I'm trying to use the plain vanilla Firebase SDK for the realtime database, and this mysterious error keeps on appearing at seemingly random read / write actions. I can't detect any recursive functions that would cause it. Any insight into what this might relate to is much appreciated.
ERROR Error: Uncaught (in promise): RangeError: Maximum call stack size exceeded
RangeError: Maximum call stack size exceeded
at ChildrenNode.isLeafNode (index.esm2017.js:5403)
at ChildrenNode.equals (index.esm2017.js:5677)
at ChildrenNode.equals (index.esm2017.js:5682)
at ChildrenNode.equals (index.esm2017.js:5682)
at ChildrenNode.equals (index.esm2017.js:5682)
at ChildrenNode.equals (index.esm2017.js:5682)
at ChildrenNode.equals (index.esm2017.js:5682)
at ChildrenNode.equals (index.esm2017.js:5682)
at ChildrenNode.equals (index.esm2017.js:5682)
at ChildrenNode.equals (index.esm2017.js:5682)
at resolvePromise (zone.js:1213)
at zone.js:1120
at asyncGeneratorStep (asyncToGenerator.js:6)
at _throw (asyncToGenerator.js:29)
at ZoneDelegate.invoke (zone.js:372)
at Object.onInvoke (core.js:28673)
at ZoneDelegate.invoke (zone.js:371)
at Zone.run (zone.js:134)
at zone.js:1276
at ZoneDelegate.invokeTask (zone.js:406)
One thing I do know is that when I don't use onValue, I don't get the error. Here is how I'm trying to convert the callback into an observable:
listenToOne(proposalId: string): Observable<SuccessOrFail<Proposal>> {
let unsub: Unsubscribe;
const subject = new BehaviorSubject<SuccessOrFail<Proposal>>(Result.fail(`Not Yet`));
get(this.getProposalRef(proposalId)).then(snapshot => {
const proposalRef = ref(this.db, `proposals/${Object.keys(snapshot.val())[0]}`);
unsub = onValue(proposalRef, snapshot => {
const spec: ProposalBuildSpec = snapshot.val();
subject.next(Result.success(this.proposalMapper.toDomain(spec)));
});
});
return subject.pipe(finalize(() => unsub()));
}
I've tried tons of variations but nothing has worked. I see there are many questions posted about the RangeError: Maximum call stack size exceeded, but nothing relating to these mysterious ChildrenNode.equals.
Any help is much appreciated! Thanks!