In official document of firebase https://www.firebase.com/docs/web/api/query/once.html. It writed
Returns a Promise that can optionally be used instead of the successCallback and failureCallback to handle success and failure.
var book = new Book(snap);
//following lines below cause error because of no promise returned.
It seems like you are using older version of
firebase, the DOC you are referring has
2.4.2 version & you had older version