2017-03-18 12 views
0

をnodejs &それについて何らかの理由を見つけることができません。は、私はこのエラーを取得していラムダEPIPEエラー

私はアマゾンAWSにこのコードを展開しています。コードの非同期実行によるものですか? Stackoverflowは詳細を追加するように私に言いますが、これ以上はありません。続き

は、私のコードのスナップショットです。

"Error: write EPIPE 
    at Object.exports._errnoException (util.js:870:11) 
    at exports._exceptionWithHostPort (util.js:893:20) 
    at WriteWrap.afterWrite (net.js:763:14)" 

    module.exports.register = function(client, body, s, rclient, redis, callback){ 
    console.log("inside registration module function"); 
    console.log(body); 
    console.log("mobile no", body.mobile_no); 

    client.connectAsync() 
.then(()=> 
{ 


return client.queryAsync('select count(*) from users where mobile_no=$1',[body.mobile_no]);}) 
.then(res=>{ 

console.log("connection successful"); 

if(res.rows[0].count==0) 
{ 
    return client.queryAsync('insert into users(mobile_no, email, city, uname, password) values ($1, $2, $3, $4, $5)', [body.mobile_no, body.email, body.city, body.uname, body.password]) 
    .then(()=>{ 
     return client.queryAsync('select uid from users where mobile_no=$1',[body.mobile_no]); 
    }) 
    .then(res=>{ 
     var uid = JSON.stringify(res); 
     uid = JSON.parse(uid).rows[0].uid; 

     console.log("uid: ", uid); 

     console.log(uid); 
     console.log(s); 
     rclient.set(s,uid,redis.print); 

     const response = { 

      statusCode:201, 
      body: JSON.stringify({ 
       sid: s, 
       message: 'user registered', 
      }), 
     }; 

     console.log('success'); 
     return Promise.promisify(response); 

    }) 
    .then(res=>{ 
     callback(null, res); 
    }) 

} 
else 
{ 
    console.log("It is already registered mobile no"); 

       const response = { 

      statusCode:412, 
      body: JSON.stringify({ 
       sid: '', 
       message: 'error: mobile no already registered', 
      }), 
     }; 

     Promise.promisify(response); 

    } 
}) 
    .then(res=>{ 
    callback(null, res); 
     }) 
    .then(()=>{ 

    client.end(); 
    rclient.quit(); 

    }) 

    .catch(err=>{ 
    console.log(err.stack); 
    console.log("error occured"); 
    }) 

} 
+0

ここで、exacltyはエラーが生成されていますか?閉じられたストリーム – Remario

+0

EPIPEエラーがお使いのノードのバージョンである<=は、ノードv0.6.16に、 – Remario

+0

にパイプする場合にスローさ – Remario

答えて

0

ノードのバージョンがv4.3.2は、最新のをダウンロードし、そのエラーのために知られています。 LTS​​または最新版の7.7.3を使用してください。これらのバージョンは安定しており、動作するはずです。

+0

amazonは現在、バージョンnodejs version6をサポートしていません。だから、それは解決策ではありません –

+0

最新のアマゾンは今サポートしていますか? – Remario

関連する問題