I have problem where with very similar code that I run on JavaScript doesn't work on node.js:

```
 exports.findDate = functions.https.onRequest((req, res) => {
    console.log("helo: " + req.query.text); // this works

    var ref = admin.database().ref("messages/events");
    const query = ref.orderByChild("start").equalTo(req.query.text);
    query.on("child_added", function(snapshot) {
        console.log(snapshot.val().title);
        res.status(200).send('ok1' + snapshot.toJSON().title);
    });
    res.status(200).send('ok'); //this print in browser
});

```

Strangely, only things outside the query work. What can cause it?

**updated code:**

```
exports.getEvents = functions.https.onRequest((req, res) => {

        admin.database().ref('events').orderByValue().once('value', function(snapshot) {
            console.log(snapshot.val().title);
            res.status(200).send('ok1');
        }).catch(error => {
            console.error('Error while reading data', error);
            res.status(403).send('Error');
        });
    });

```

[![enter image description here](https://i.stack.imgur.com/W51hf.png)](https://i.stack.imgur.com/W51hf.png)