title: firebase function with realtime database error
body: <p>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.</p>
  <p>Error:</p>
  <pre><code>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. 
  </code></pre>
  <p>firebase function code :</p>
  <pre><code>const functions = require('firebase-functions');
  var admin = require(&quot;firebase-admin&quot;);
  admin.initializeApp(); 
  
  var database = admin.database();
  
  exports.helloWorld = functions.https.onRequest((request, response) =&gt; {
      response.send(&quot;Hello from Firebase!&quot;);
  });
  
  exports.textToLength = functions.https.onRequest((request, response) =&gt; {
      var tex = request.query.text;
      var textLength = tex.length;
      console.log(textLength);
      database.ref().child('test').set(&quot;op&quot;);
      response.send(String(textLength));
  });
  </code></pre>
  <p>dependencies :</p>
  <pre><code>{
    &quot;name&quot;: &quot;functions&quot;,
    &quot;description&quot;: &quot;Cloud Functions for Firebase&quot;,
    &quot;scripts&quot;: {
      &quot;serve&quot;: &quot;firebase emulators:start --only functions&quot;,
      &quot;shell&quot;: &quot;firebase functions:shell&quot;,
      &quot;start&quot;: &quot;npm run shell&quot;,
      &quot;deploy&quot;: &quot;firebase deploy --only functions&quot;,
      &quot;logs&quot;: &quot;firebase functions:log&quot;
    },
    &quot;engines&quot;: {
      &quot;node&quot;: &quot;14&quot;
    },
    &quot;main&quot;: &quot;index.js&quot;,
    &quot;dependencies&quot;: {
      &quot;firebase-admin&quot;: &quot;^9.8.0&quot;,
      &quot;firebase-functions&quot;: &quot;^3.14.1&quot;,
      &quot;@firebase/database-compat&quot;: &quot;0.1.2&quot; 
    },
    &quot;devDependencies&quot;: {
      &quot;firebase-functions-test&quot;: &quot;^0.2.0&quot;
    },
    &quot;private&quot;: true
  }
  </code></pre>
  <p>npm installed packages</p>
  <pre><code>+-- @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
  </code></pre>