2017-11-01 13 views
0

私は特急ここで使用してNodeJSアプリケーションを構築していますが、私のコードです:502不正なゲートウェイのnginxのGoogleのアプリエンジン

var express = require('express'); 
var app = express(); 
var session = require('express-session'); 
var uuidv1 = require('uuid/v1'); 
require('dotenv').config(); 

var APIAI_TOKEN = process.env.APIAI_TOKEN; 
var APIAI_SESSION_ID = uuidv1(); 

app.use(express.static(__dirname + '/views')); // html 
app.use(express.static(__dirname + '/public')); // js, css, images 

var server = require('http').createServer(app); 
var port = process.env.port || 3000; 

server.listen(port, function() { 
    console.log('Server listening at port: ', port); 
    // console.log(APIAI_SESSION_ID); 
    // console.log(APIAI_TOKEN); 
}); 

app.use(session({ 
    genid: function(req) { 
     return APIAI_SESSION_ID; 
    }, 
    secret: 'secret', 
    saveUninitialized: true, 
    resave: true 
})); 

var io = require('socket.io')(server); 

var apiai = require('apiai')(APIAI_TOKEN); 
var rp = require('request-promise'); 

//#region Web UI 

app.get('/', function(req, res) { 
    res.sendFile('index.html'); 
}); 

私は、ノードのアプリで私のアプリを起動して、すべてが私のローカルホスト上で完璧に動作しますが、私はアプリを展開するとき私は502の悪いゲートウェイのエラーを取得し、私はapp.get()メソッドで発生するログをチェックするときにGoogle Appエンジンに。 私はそれをHerokuサーバーにも配備しました。アプリケーションは同じ時点でクラッシュしています。私のコードで何が間違っているのでしょうか? Herokuの程度

2017-11-01T16:35:57.528020+00:00 heroku[router]: at=error code=H10 

desc="App crashed" method=GET path="/" host=ippcbot.herokuapp.com request_id=d956df30-8352-4a54-80e6-2aa1fc96276b fwd="197.210.37.211" dyno= connect= service= status=503 bytes= protocol=https 
2017-11-01T16:35:58.138751+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=ippcbot.herokuapp.com request_id=96b2bf0d-df05-4d7e-9018-0b09e1dfa748 fwd="197.210.37.211" dyno= connect= service= status=503 bytes= protocol=https 
Disconnected from log stream. There may be events happening that you do not see here! Attempting to reconnect... 
2017-11-01T16:19:36.517868+00:00 app[web.1]: npm ERR! Please include the following file with any support request: 
2017-11-01T16:19:36.513572+00:00 app[web.1]: npm ERR! There is likely additional logging output above. 
2017-11-01T16:19:36.517927+00:00 app[web.1]: npm ERR!  /app/npm-debug.log 
2017-11-01T16:19:36.584087+00:00 heroku[web.1]: Process exited with status 1 
2017-11-01T16:19:36.607609+00:00 heroku[web.1]: State changed from starting to crashed 
2017-11-01T16:20:47.248202+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=ippcbot.herokuapp.com request_id=41e9f39b-e908-4cee-a430-0d7f44a17590 fwd="197.210.37.211" dyno= connect= service= status=503 bytes= protocol=https 
2017-11-01T16:20:47.891459+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=ippcbot.herokuapp.com request_id=9f244daf-7a3e-405e-b445-2fadd8b2735b fwd="197.210.37.211" dyno= connect= service= status=503 bytes= protocol=https 
2017-11-01T16:35:13.187594+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=ippcbot.herokuapp.com request_id=455ccd5e-e389-49be-b892-e5e222c9864f fwd="197.210.37.211" dyno= connect= service= status=503 bytes= protocol=https 
2017-11-01T16:35:13.805998+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=ippcbot.herokuapp.com request_id=112a5f08-632e-463d-b8e8-ed6de13b3596 fwd="197.210.37.211" dyno= connect= service= status=503 bytes= protocol=https 
2017-11-01T16:35:57.528020+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=ippcbot.herokuapp.com request_id=d956df30-8352-4a54-80e6-2aa1fc96276b fwd="197.210.37.211" dyno= connect= service= status=503 bytes= protocol=https 
2017-11-01T16:35:58.138751+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=ippcbot.herokuapp.com request_id=96b2bf0d-df05-4d7e-9018-0b09e1dfa748 fwd="197.210.37.211" dyno= connect= service= status=503 bytes= protocol=https 

答えて

0

わからないが、App Engineのために8080作品にポートを変更しない:ここで は、ログ形式Herokuのサーバのですか?例えば

Run Express.js on Google App Engine Flexible Environment

から

const server = app.listen(8080,() => { 
    const host = server.address().address; 
    const port = server.address().port; 

    console.log(`Example app listening at http://${host}:${port}`); 
}); 

関連する問題