4

My node js application process which was working fine all of a sudden has stopped working and is erroring out with Sigterm error. I have tried to scale to standard 1x type and increased web dyno size as well. But Still I get the same error. Please Help

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

Code

// 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 Answers0