Express 是什么导致了这次heroku坠机?错误代码=H10

Express 是什么导致了这次heroku坠机?错误代码=H10,express,heroku,sequelize.js,auth0,Express,Heroku,Sequelize.js,Auth0,我查看了过去关于这个问题的帖子,很多人建议heroku重新启动,或者重新启动dynos,或者确保使用var PORT=process.env.PORT | 3000。我已经做了所有这些,但我的应用程序仍然崩溃。应用程序使用node/express sequelize/auth0运行 有人有什么建议吗?谢谢 以下是日志: 2017-09-08T02:11:37.293051+00:00 app[web.1]: at emitOne (events.js:96:13) 2017-09-0

我查看了过去关于这个问题的帖子,很多人建议heroku重新启动,或者重新启动dynos,或者确保使用var PORT=process.env.PORT | 3000。我已经做了所有这些,但我的应用程序仍然崩溃。应用程序使用node/express sequelize/auth0运行

有人有什么建议吗?谢谢

以下是日志:

 2017-09-08T02:11:37.293051+00:00 app[web.1]:     at emitOne 
(events.js:96:13)
2017-09-08T02:11:37.293052+00:00 app[web.1]:     at Socket.emit 
(events.js:188:7)
2017-09-08T02:11:37.293053+00:00 app[web.1]:     at emitErrorNT 
(net.js:1277:8)
2017-09-08T02:11:37.293054+00:00 app[web.1]:     at 
_combinedTickCallback (internal/process/next_tick.js:80:11)
2017-09-08T02:11:37.293055+00:00 app[web.1]:     at 
process._tickCallback (internal/process/next_tick.js:104:9)
2017-09-08T02:11:37.364314+00:00 heroku[web.1]: State changed from 
starting to crashed
2017-09-08T02:11:37.353673+00:00 heroku[web.1]: Process exited with 
status 0
2017-09-08T02:11:49.712881+00:00 heroku[router]: at=error code=H10 
desc="App crashed" method=GET path="/" host=roadie2.herokuapp.com 
request_id=79e0bc3a-aa28-44bb-ab80-cfcf4f6cd97d fwd="99.92.51.34" 
dyno= connect= service= status=503 bytes= protocol=https
2017-09-08T02:11:50.564503+00:00 heroku[router]: at=error code=H10 
desc="App crashed" method=GET path="/favicon.ico" 
host=roadie2.herokuapp.com request_id=c72e5077-494c-41f5-8be1-
f0c2c329d080 fwd="99.92.51.34" dyno= connect= service= status=503 
bytes= protocol=https
2017-09-08T02:12:24.838901+00:00 heroku[router]: at=error code=H10 
desc="App crashed" method=GET path="/" host=roadie2.herokuapp.com 
request_id=ca551858-5372-40c9-abf1-670176b159dc fwd="99.92.51.34" 
dyno= connect= service= status=503 bytes= protocol=https
2017-09-08T02:12:25.340624+00:00 heroku[router]: at=error code=H10 
desc="App crashed" method=GET path="/favicon.ico" 
host=roadie2.herokuapp.com request_id=c37b876d-5a59-40d0-9d59-
9be013c58d94 fwd="99.92.51.34" dyno= connect= service= status=503 
bytes= protocol=https
下面是输入heroku日志后的最后一部分结果——tail

config.json

 {
 "development": {
"username": "root",
"password":"",
"database": "roadie2",
"host": "127.0.0.1",
"dialect": "mysql"
 },
"test": {
"username": "root",
"password": null,
"database": "database_test",
"host": "127.0.0.1",
"dialect": "mysql"
 },
 "production": {
"use_env_variable": "JAWSDB_URL",
"dialect": "mysql"
}
}
server.js

var express = require("express");
var bodyParser = require("body-parser");

// Sets up the Express App
// =============================================================
var app = express();
// var PORT = process.env.PORT || 3000;
var port = process.env.PORT 

// Requiring our models for syncing
var db = require("./models");

// Sets up the Express app to handle data parsing
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.text());
app.use(bodyParser.json({ type: "application/vnd.api+json" }));



// Static directory
app.use(express.static("./public"));

// Routes =============================================================

require("./routes/html-routes.js")(app);
require("./routes/api-routes.js")(app);

// Syncing our sequelize models and then starting our express app
db.sequelize.sync().then(function() {
  app.listen(port, function() {
    console.log("App listening on PORT " + port);
  });
}))

models/index.js

'use strict';

var fs        = require('fs');
var path      = require('path');
var Sequelize = require('sequelize');
var basename  = path.basename(module.filename);
var env       = process.env.NODE_ENV || 'development';
var config    = require(__dirname + '/../config/config.json')[env];
var db        = {};

if (config.use_env_variable) {
  var sequelize = new 
Sequelize(process.env[config.use_env_variable]);
} else {
  var sequelize = new Sequelize(config.database, config.username, 
config.password, config);
}

fs
  .readdirSync(__dirname)
  .filter(function(file) {
    return (file.indexOf('.') !== 0) && (file !== basename) && 
(file.slice(-3) === '.js');
  })
  .forEach(function(file) {
    var model = sequelize['import'](path.join(__dirname, file));
db[model.name] = model;
 });

Object.keys(db).forEach(function(modelName) {
  if (db[modelName].associate) {
  db[modelName].associate(db);
 }
});

db.sequelize = sequelize;
db.Sequelize = Sequelize;

module.exports = db;

您的日志清楚地告诉您为什么会崩溃:

2017-09-08T02:11:37.293030+00:00 app[web.1]: Unhandled rejection . 
SequelizeConnectionRefusedError: connect ECONNREFUSED 127.0.0.1:3306
您无法连接到SQL server

从外观上看,您似乎试图连接到无法工作的
127.0.0.1:3306
127.0.0.1
localhost
是您的本地IP

您需要安装/连接到插件或使用外部SQL服务,如。

您的日志清楚地告诉您为什么会崩溃:

2017-09-08T02:11:37.293030+00:00 app[web.1]: Unhandled rejection . 
SequelizeConnectionRefusedError: connect ECONNREFUSED 127.0.0.1:3306
您无法连接到SQL server

从外观上看,您似乎试图连接到无法工作的
127.0.0.1:3306
127.0.0.1
localhost
是您的本地IP


您需要安装/连接到加载项或使用外部SQL服务,例如。

我使用的是JawsDB Maria加载项,我的server.js和config.json文件的设置与我其他成功的节点/续集应用程序基本相同,所以我不知道它为什么要抓取127.0.0.1:3306。你能用调用
new Sequelize()
的代码更新这个问题吗?我已经添加了包含唯一新Sequelize()调用的文件。我使用的是JawsDB Maria addon,我的server.js和config.json文件的设置与我其他成功的节点/sequelized应用程序的设置基本相同,所以我不确定它为什么要抓取127.0.0.1:3306。你能用调用
new Sequelize()
的代码更新这个问题吗?我已经添加了包含唯一新Sequelize()调用的文件。