title: Client network socket disconnected before secure TLS connection was established Node.js v13.0.1
body: <p>When id add exports.create=functions.https.onRequest((req,res)=> and run command firebase deploy shows this result</p>
  
  <pre><code>functions: Finished running predeploy script.
  i  functions: ensuring necessary APIs are enabled...
  +  functions: all necessary APIs are enabled
  i  functions: preparing functions directory for uploading...
  i  functions: packaged functions (40.37 KB) for uploading
  !  functions: Upload Error: Server Error. Client network socket disconnected before secure TLS connection was established
  
  Error: Server Error. Client network socket disconnected before secure TLS connection was established
  </code></pre>
  
  <p>please check the code below.....</p>
  
  <pre><code>const firebase = require('firebase-admin');
  
  
  var config = {
      apiKey: "AIzaSyAzf0Y4k7qvkWSWkwgsYjH9mrnFa_P9xt4",
      authDomain: "fir-test-dc973.firebaseapp.com",
      databaseURL: "https://fir-test-dc973.firebaseio.com/",
      storageBucket: "gs://fir-test-dc973.appspot.com/"
    };
    firebase.initializeApp(config);
  
  
  exports.create=functions.https.onRequest((req,res)=&gt;{
  
    var data=JSON.parse(req.body);
    var user_id=data.user_id;
  
  var language_id=data.language_id;
    firebase.database().ref("game_room/").orderByChild("availability").equalTo(1).limitToFirst(1).once('value', ((snapshot)=&gt; {
       console.log("user_id  ",user_id);
  
  
      if (snapshot.val() !== null) {
              console.log("available");
              var childKey = Object.keys(snapshot.val());
              console.log("gameroom   ", childKey);
  
  
              const userQuery = firebase.database().ref(`game_room/${childKey}`).once('value');
              const language_id1 = userQuery.val().language_id;
              if (language_id === language_id1) {
                   firebase.database().ref(`game_room/${childKey}/${user_id}`).update({
                          "status": true,
                          "right": 0,
                          "wrong": 0,
                          "que_no": 0,
                          "sel_ans": "",
                      });
                    firebase.database().ref(`game_room/${childKey}`).update({
                          "availability": 2,
  
                      });
  
                  }else{
                      createGameRoom();
                  }
  
              console.log(snapshot.val());
          }
      else
      {
  
          createGameRoom();
  
  
      }
  
      }));
  
  
    function createGameRoom() {
      console.log("not available");
                  var ref=firebase.database().ref('game_room/').push({
                      "availability":1,  
                      "language_id":language_id,
  
  
                      });
  
                          console.log(ref.key);
                          var key=ref.key;
                              console.log(key);
                           var ref1= firebase.database().ref(`game_room/${key}/${user_id}`).update({//.push({
                                      //ref.set({
                                  "status":true,
                              "right":0,
                              "wrong":0,
                              "que_no":0,
                              "sel_ans":"",
  
                                  });
  
  
  
  
  }
   res.send({"code":user_id});
  });```
  
  log is here 
  [debug] [2020-01-03T13:50:53.722Z] &lt;&lt;&lt; HTTP RESPONSE 200
  [debug] [2020-01-03T13:50:53.725Z] &gt;&gt;&gt; HTTP REQUEST PUT https://storage.googleapis.com/gcf-upload-us-central1-46ce5050-804a-4464-a2b2-569f0e4aaa93/75a761e4-936f-4b66-8f59-bb043b386f8d.zip?GoogleAccessId=service-853915451227@gcf-admin-robot.iam.gserviceaccount.com&amp;Expires=1578061220&amp;Signature=KBV5Gmv3OObNlC8%2BuCwYptBWjPI%2BhGblYX644ugU15FPwwFITQ3VDSIM7%2F9xsK2UqjFhdjx8s2inymbffxoemRmN1mKqPbHGP0ZFCy%2FDQUAHR%2FUccF%2FtRBiG2EQ0oaU5m9T7NoTs1NnVmDNhGz25mIGNdkO0efv8ZOqfXCYOSLV1jbgQtUGv%2FB%2ButjsTB3b6nxBOwHj7HbsFt1pB4uqGmVitGxj0JvxOhSAK6pCWXrsbWgL%2FnnoktYhhyMWFt9YgTSdWB36OeigQCdVldRVIodpaa3aShfDwMRPQCktgQQWZX0tAPsScs62i5Y11PLvSk2VeGxFFZgAyEA1XrzPjyg%3D%3D  
   &lt;request body omitted&gt;
  [warn] !  functions: Upload Error: Server Error. Client network socket disconnected before secure TLS connection was established
  [debug] [2020-01-03T13:51:04.100Z] Error: Client network socket disconnected before secure TLS connection was established
      at connResetException (internal/errors.js:575:14)
      at TLSSocket.onConnectEnd (_tls_wrap.js:1361:19)
      at Object.onceWrapper (events.js:299:28)
      at TLSSocket.emit (events.js:215:7)
      at TLSSocket.EventEmitter.emit (domain.js:478:20)
      at endReadableNT (_stream_readable.js:1198:12)
      at processTicksAndRejections (internal/process/task_queues.js:80:21)
  [error] 
  [error] Error: Server Error. Client network socket disconnected before secure TLS connection was established
  
  
  </code></pre>