我的节点 js 应用程序进程突然停止工作,并出现 Sigterm 错误。我试图扩展到标准的 1x 类型并增加了 web dyno 大小。但我仍然得到同样的错误。请帮忙
2017-10-16T19:53:23.268194+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2017-10-16T19:53:23.381317+00:00 heroku[web.1]: Process exited with status 143
2017-10-16T19:53:24.683700+00:00 heroku[web.1]: Starting process with command `node index.js`
2017-10-16T19:53:28.917250+00:00 app[web.1]: Running on port 39434
2017-10-16T19:53:29.043431+00:00 heroku[web.1]: State changed from starting to up
代码
// call the packages we need
var express = require('express'); // call express
var app = express(); // define our app using express
var bodyParser = require('body-parser');
var jsforce = require('jsforce');
var fs = require('fs');
// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: false }))
// parse application/json
app.use(bodyParser.json())
var port = process.env.PORT || 8080; // set our port
// ROUTES FOR OUR API
// =============================================================================
var router = express.Router(); // get an instance of the express Router
var basicAuth = require('basic-auth');
var auth = function (req, res, next) {
function unauthorized(res) {
res.set('WWW-Authenticate', 'Basic realm=Authorization Required');
return res.sendStatus(401);
};
var user = basicAuth(req);
if (!user || !user.name || !user.pass) {
return unauthorized(res);
};
if (user.name === '------' && user.pass === '------') {
return next();
} else {
return unauthorized(res);
};
};
router.get('/', function(req, res) {
res.sendStatus(500);
});
router.post('/send',auth, function(req, res) {
});
// REGISTER OUR ROUTES -------------------------------
// all of our routes will be prefixed with /api
app.use('/api', router);
// START THE SERVER
// =============================================================================
app.listen(port);
console.log('Running on port ' + port);