Luca Mormile Luca Mormile - 4 months ago 31x
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.


This has been working in my application:

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