Skip to content
Advertisement

“TypeError: db._checkNotDeleted is not a function” when creating a db Ref on Firebase

I’m working on a web app in html (and vanilla JS) that uses firebase for checking and updating values on a Realtime Database, I keep getting a lot of errors but still can’t figure out what I’m getting wrong. I’m sorry I’m new to JS and firebase.

enter image description here

Relevant html code (table inside form):

JavaScript

JS after body ends:

JavaScript

The database looks like this:

JavaScript

I’ve tried changing

JavaScript

to

JavaScript

I simply want to verify with the database that the ‘voucher’ (cedula + #v) hasn’t been used yet (it’s associated value is 1), that the ‘phoneNumber’ (Telefono del conductor) exists, and if so change ‘voucher’ value to 0 and add one to the value associated with ‘phoneNumber’.

Advertisement

Answer

The ref() function takes an instance of Database as parameter and not the getDatabase function itself.

JavaScript

Also, the child() function doesn’t actually fetch the data from Firebase server. You must use get() function to get the value. Try refactoring the code as shown below:

JavaScript

Checkout the documentation for more information.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement