Node Js app stooped运行,使用SIGTERM进程停止所有进程,状态为143

时间:2017-10-16 20:07:36

标签: node.js heroku heroku-api

我的节点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);

0 个答案:

没有答案