Closed jorbascrumps closed 5 years ago
Just noting the other related Firebase issue reported recently: #329.
I'm hoping someone more familiar with Firebase can take a look at this.
From what I can tell, this is only an issue because Firebase returns null
for empty values. I've been poking around and, unless I'm mistaken, the storage APIs are only called in Master
. If this is correct, then we could simply coerce the return value of Firebase#get
to be undefined
instead of null
.
What are your thoughts on such a change, @nicolodavis?
Sounds good to me. You can actually verify this without any changes to boardgame.io by copying the firebase adapter implementation and passing it as a custom db adapter to Server
in your code.
Feel free to send me a PR if your proposed fix works.
I'm attempting to add Firebase storage to my game. I have correctly configured my connection and have been able to store data with Firestore previously. However, I switched to RTDB as that is my preference and received the following error with an empty database:
From what I can tell, this error occurs because
Firebase#get
is returning a null document if it has yet to be created andMaster#onSync
is expectingundefined
when checking if a game has been initialized.I have not yet fully explored the repercussions of adjusting the
Firebase#get
return value or updating the condition inMaster#onSync
(possible inconsistencies with other storage APIs?).