I am new to firebase function and trying to use firebase function with Realtime database (Emulator suite).But when i try to set the value in firebase using the firebase function,it gives an error and doesn't set the value in database.

Error:

```
17:33:14
I
function[us-central1-textToLength]
[2021-11-05T12:03:14.194Z]  @firebase/database: FIREBASE WARNING: wss:// URL used, but browser isn't known to support websockets.  Trying anyway. 
17:34:18
I
function[us-central1-textToLength]
[2021-11-05T12:04:18.762Z]  @firebase/database: FIREBASE WARNING: wss:// URL used, but browser isn't known to support websockets.  Trying anyway. 
17:35:06
I
function[us-central1-textToLength]
[2021-11-05T12:05:06.473Z]  @firebase/database: FIREBASE WARNING: wss:// URL used, but browser isn't known to support websockets.  Trying anyway. 
17:35:54
I
function[us-central1-textToLength]
[2021-11-05T12:05:54.409Z]  @firebase/database: FIREBASE WARNING: wss:// URL used, but browser isn't known to support websockets.  Trying anyway. 

```

firebase function code :

```
const functions = require('firebase-functions');
var admin = require("firebase-admin");
admin.initializeApp(); 

var database = admin.database();

exports.helloWorld = functions.https.onRequest((request, response) => {
    response.send("Hello from Firebase!");
});

exports.textToLength = functions.https.onRequest((request, response) => {
    var tex = request.query.text;
    var textLength = tex.length;
    console.log(textLength);
    database.ref().child('test').set("op");
    response.send(String(textLength));
});

```

dependencies :

```
{
  "name": "functions",
  "description": "Cloud Functions for Firebase",
  "scripts": {
    "serve": "firebase emulators:start --only functions",
    "shell": "firebase functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log"
  },
  "engines": {
    "node": "14"
  },
  "main": "index.js",
  "dependencies": {
    "firebase-admin": "^9.8.0",
    "firebase-functions": "^3.14.1",
    "@firebase/database-compat": "0.1.2" 
  },
  "devDependencies": {
    "firebase-functions-test": "^0.2.0"
  },
  "private": true
}

```

npm installed packages

```
+-- @firebase/app-compat@0.1.7
| +-- @firebase/app@0.7.6
| | +-- @firebase/component@0.5.8
| | | +-- @firebase/util@1.4.1 deduped
| | | `-- tslib@2.3.1 deduped
| | +-- @firebase/logger@0.3.1
| | | `-- tslib@2.3.1 deduped
| | +-- @firebase/util@1.4.1
| | | `-- tslib@2.3.1 deduped
| | `-- tslib@2.3.1 deduped
| +-- @firebase/component@0.5.8
| | +-- @firebase/util@1.4.1 deduped
| | `-- tslib@2.3.1 deduped
| +-- @firebase/logger@0.3.1
| | `-- tslib@2.3.1 deduped
| +-- @firebase/util@1.4.1
| | `-- tslib@2.3.1 deduped
| `-- tslib@2.3.1
+-- @firebase/database-compat@0.1.2
| +-- @firebase/component@0.5.7
| | +-- @firebase/util@1.4.0 deduped
| | `-- tslib@2.3.1 deduped
| +-- @firebase/database@0.12.2
| | +-- @firebase/auth-interop-types@0.1.6
| | +-- @firebase/component@0.5.7 deduped
| | +-- @firebase/logger@0.3.0 deduped
| | +-- @firebase/util@1.4.0 deduped
| | +-- faye-websocket@0.11.4
| | | `-- websocket-driver@0.7.4
| | |   +-- http-parser-js@0.5.3
| | |   +-- safe-buffer@5.2.1 deduped
| | |   `-- websocket-extensions@0.1.4
| | `-- tslib@2.3.1 deduped
| +-- @firebase/database-types@0.9.1
| | +-- @firebase/app-types@0.7.0
| | `-- @firebase/util@1.4.0 deduped
| +-- @firebase/logger@0.3.0
| | `-- tslib@2.3.1 deduped
| +-- @firebase/util@1.4.0
| | `-- tslib@2.3.1 deduped
| `-- tslib@2.3.1 deduped
`-- firebase-admin@10.0.0
  +-- @firebase/database-compat@0.1.2 deduped
  +-- @firebase/database-types@0.7.3
  | `-- @firebase/app-types@0.6.3
  +-- @google-cloud/firestore@4.15.1
  | +-- fast-deep-equal@3.1.3
  | +-- functional-red-black-tree@1.0.1
  | +-- google-gax@2.28.0

```