Firebase "set" completes the callback does not fire

I played with Firebase (a free plan) and ran into a problem with the completion callback for set , which is not called when the installed data exceeds a certain number of keys. The limit varies depending on how deep your data is embedded, but for one deep object, this limit is 1453 keys. Above 1453 and the completion callback never works.

 var data = {}; // Change 1453 to 1454 and the completion callback never fires for (var i = 0; i < 1453; i++) { data[i] = true; } rootRef.set(data, function (err) { console.log(err); }); 

Has anyone else encountered this problem or guessed why this is happening?

EDIT: I do it in node

+5
source share
1 answer

He works as intended. The callback associated with the .set () method is optional and will only receive an obj error if an error occurs. Since there seems to be no error since the data is being written to firebase, then the resulting err parameter is actually null, and therefore you see nothing in the console.

adjust the .log console as follows:

 rootRef.set(data, function (err) { console.log("callback complete! ", err); }); 

Now, if you run your code, you will see that "callback complete!" in the console, and you will only see "err" if it really exists.

0
source

Source: https://habr.com/ru/post/1200512/


All Articles