title: Heroku returns Process exited with status 143
body: <p>I'm about to finish an <strong>Ionic2</strong> application that uses <strong>socket.io</strong>.
  I use to run (locally) my app with <code>ionic serve</code> (client side) in one terminal and with <code>node index.js</code> (server side) on another terminal. (index.js file is inside my ionic2 project folder).
  Now I want to try this out with Heroku.</p>
  
  <p>These are the server side files I have:</p>
  
  <p>My index.js file looks like this:</p>
  
  <pre><code>var io = require('socket.io'),
      http = require('http'),
      server = http.createServer(),
      io = io.listen(server);
  ...
  ...
  my real code here
  ...
  ...
  server.listen(process.env.PORT || 3000, function(){
    console.log('Server started, listening on' + process.env.PORT);
  });
  </code></pre>
  
  <p>along with index.js I created (<code>npm init</code>) a package json which looks like this:</p>
  
  <pre><code>{
    "name": "myApplication",
    "version": "0.2.5",
    "description": "just a server",
    "engines": {
      "node": "4.2.6"
    },
    "main": "index.js",
    "scripts": {
      "start": "node index.js"
    },
    "dependencies": {
      "ejs": "2.4.1",
      "express": "4.13.3",
      "socket.io": "^1.5.0"
    },
    "repository": {
      "type": "git",
      "url": "https://github.com/xxxxxxxxx"
    },
    "keywords": [
      "node",
      "heroku",
      "express"
    ],
    "license": "MIT"
  }
  </code></pre>
  
  <p>Procfile content is this: <code>web: node index.js</code></p>
  
  <p>While <code>app.json</code> holds this:</p>
  
  <pre><code>{
    "name": "MyAppServer",
    "description": "",
    "repository": "https://github.com/xxxxxxxx",
    "logo": "http://node-js-sample.herokuapp.com/node.svg",
    "keywords": ["node", "express", "static"],
    "image": "heroku/nodejs"
  }
  </code></pre>
  
  <p>Before pushing all this stuff into github repo I've done <code>npm install</code> so I got <code>node_modules</code> folder.
  So I pushed everything on a github repo and then <code>heroku login</code>, <code>heroku create</code>. Finally <code>git push heroku master</code> returned me <code>Build succeeded</code> but now, when I do <code>heroku open</code> I see a page which says <strong>Application Error</strong>. </p>
  
  <p>These are the warnings I get when I do <code>heroku logs</code>:</p>
  
  <pre><code>    2016-10-31T14:00:05.707656+00:00 heroku[web.1]: Idling
      2016-10-31T14:00:05.708289+00:00 heroku[web.1]: State changed from up to down
      2016-10-31T14:00:08.267802+00:00 heroku[web.1]: Stopping all processes with SIGTERM
      2016-10-31T14:00:09.009402+00:00 heroku[web.1]: Process exited with status 143
      2016-10-31T16:34:38.691494+00:00 heroku[web.1]: State changed from down to starting
      2016-10-31T16:34:40.170397+00:00 heroku[web.1]: Starting process with command `node index.js`
      2016-10-31T16:34:42.503141+00:00 app[web.1]: Server started, listening on39519
      2016-10-31T16:34:43.875418+00:00 heroku[web.1]: State changed from starting to up
  
  2016-10-31 heroku[router]: at=error code=H12
   desc="Request timeout" method=GET path="/" host=xxxx-xxxx-xxxx.herokuapp.com 
  request_id=20f79d56-4e51-4ace-af50-9b332e9778a1 fwd="my IP address here" dyno=web.1 connect=0ms 
  service=30000ms status=503 bytes=0
  </code></pre>