客户端网络套接字在建立安全 TLS 连接之前断开连接 Node.js v13.0.1

Posted

技术标签:

【中文标题】客户端网络套接字在建立安全 TLS 连接之前断开连接 Node.js v13.0.1【英文标题】:Client network socket disconnected before secure TLS connection was established Node.js v13.0.1 【发布时间】:2020-04-22 02:30:12 【问题描述】:

当 id add exports.create=functions.https.onRequest((req,res)=> 并运行命令 firebase deploy 显示此结果

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

请检查下面的代码.....

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)=>

  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)=> 
     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] <<< HTTP RESPONSE 200
[debug] [2020-01-03T13:50:53.725Z] >>> 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&Expires=1578061220&Signature=KBV5Gmv3OObNlC8%2BuCwYptBWjPI%2BhGblYX644ugU15FPwwFITQ3VDSIM7%2F9xsK2UqjFhdjx8s2inymbffxoemRmN1mKqPbHGP0ZFCy%2FDQUAHR%2FUccF%2FtRBiG2EQ0oaU5m9T7NoTs1NnVmDNhGz25mIGNdkO0efv8ZOqfXCYOSLV1jbgQtUGv%2FB%2ButjsTB3b6nxBOwHj7HbsFt1pB4uqGmVitGxj0JvxOhSAK6pCWXrsbWgL%2FnnoktYhhyMWFt9YgTSdWB36OeigQCdVldRVIodpaa3aShfDwMRPQCktgQQWZX0tAPsScs62i5Y11PLvSk2VeGxFFZgAyEA1XrzPjyg%3D%3D  
 <request body omitted>
[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


【问题讨论】:

有什么解决办法吗?我也遇到过同样的问题。在过去 24 小时内没有得到任何解决方案。 是的,有网络问题。 【参考方案1】:

看起来您在部署过程中可能遇到了某种网络错误。当 CLI 生成这样的错误消息并没有提供明确的解决方案时,您应该contact Firebase support directly 进行故障排除。

【讨论】:

以上是关于客户端网络套接字在建立安全 TLS 连接之前断开连接 Node.js v13.0.1的主要内容,如果未能解决你的问题,请参考以下文章

在建立安全 TLS 连接之前,Netlify 和 Faunadb 客户端网络套接字断开连接

客户端网络套接字在建立安全 TLS 连接之前断开连接 Node.js v13.0.1

Neo4jError:客户端网络套接字在建立安全 TLS 连接之前断开

TLS(SSL)

vb2010 (vb.net )Socket套接字当网络中断时或服务器意外关机,客户端如何自动重新连接服务端

使用烧瓶socketio经常断开套接字连接