Luca Mormile Luca Mormile - 1 year ago 87
Node.js Question

Firebase 3 - Can't retrieve data from database (Web)

I'm working on a webapp using

Firebase 3
(the latest version) for the first time but I'm having troubles with
retrieving data
on my page.

I've created a
test app from
, then I'm trying to retrieve my data in JSON format (ref's path goes to my data array) saved in my Firebase
realtime database
I've followed the doc, but without results.

Here's my code:

<script src=""></script>

// Initialize Firebase
var config = {
apiKey: "*******",
authDomain: "*******",
databaseURL: "*******",
storageBucket: "*******",

firebase.database().ref('my/path/to/data').on('value', function(snapshot) {
console.log('kk'); //no log in the console


There are no errors in the console, but no results too. It seems so simple to do but I can't figure out what I'm missing.

Answer Source

This has been working in my application:

  .then((snapshot) => { console.log('hi') });