title: Heroku - crash all the time
body: <p>I am developing node.js app on heroku. For now it runs on single (free) dyno.</p>
  
  <p>For some reason suddenly my app crashed and now it crashes all the time (I observed it after adding NewRelic and Librato addons - app is kind of restarted when adding those addons) - app crashed for the first time after one of those addons were added. So I removed both addons but problem still remained. I wanted to check whats wrong and I commented my app code and replaced it with simple example from the web:</p>
  
  <p>index.js</p>
  
  <pre><code>var http = require('http');
  http.createServer(function (req, res) {
     res.writeHead(200, {'Content-Type': 'text/plain'});
     res.end('Hello World\n');
  }).listen(process.env.PORT);
  console.log('Server running at http://127.0.0.1:1337/');
  </code></pre>
  
  <p>Procfile</p>
  
  <pre><code>web: node index.js
  </code></pre>
  
  <p>engines in packages.json (node installed by heroku is 0.10.26)</p>
  
  <pre><code>"engines": {
     "node": "0.10.x"
  },
  </code></pre>
  
  <p>This code works on my pc (tested with foreman).
  When I try to deploy it to heroku app crashes - here is the log:</p>
  
  <pre><code>2014-04-25T09:43:42+00:00 heroku[slug-compiler]: Slug compilation started
  2014-04-25T09:43:47.850609+00:00 heroku[api]: Release v30 created by xxx
  2014-04-25T09:43:47.850538+00:00 heroku[api]: Deploy 562babb by xxx
  2014-04-25T09:43:47+00:00 heroku[slug-compiler]: Slug compilation finished
  2014-04-25T09:43:48.588089+00:00 heroku[web.1]: State changed from crashed to starting
  2014-04-25T09:43:55.655057+00:00 heroku[web.1]: Starting process with command `node index.js`
  2014-04-25T09:43:57.931274+00:00 heroku[web.1]: Process exited with status 8
  2014-04-25T09:43:57.945393+00:00 heroku[web.1]: State changed from starting to crashed
  </code></pre>
  
  <p>when I try to <code>heroku restart</code>:</p>
  
  <pre><code>2014-04-25T09:44:43.071357+00:00 heroku[web.1]: State changed from crashed to starting
  2014-04-25T09:44:51.834860+00:00 heroku[web.1]: Starting process with command `node index.js`
  2014-04-25T09:44:54.250631+00:00 heroku[web.1]: State changed from starting to crashed
  2014-04-25T09:44:54.235545+00:00 heroku[web.1]: Process exited with status 8
  </code></pre>
  
  <p>This make me crazy - I deployed many node apps to heroku which are runing in production and had never such problems - whats going on???</p>
  
  <hr>
  
  <p>When I changed node engine version to <code>0.10.20</code> (I am using this v localy) then app started and was working but when I did <code>heroku restart</code> it crashed again...</p>
  
  <pre><code>State changed from up to starting
  2014-04-25T10:10:12.990317+00:00 heroku[web.1]: Stopping all processes with SIGTERM
  2014-04-25T10:10:15.145758+00:00 heroku[web.1]: Process exited with status 143
  2014-04-25T10:10:16.151380+00:00 heroku[web.1]: Starting process with command `node index.js`
  2014-04-25T10:10:18.905637+00:00 heroku[web.1]: Process exited with status 8
  2014-04-25T10:10:18.929730+00:00 heroku[web.1]: State changed from starting to crashed
  </code></pre>
  
  <hr>
  
  <p>after second restart app was <code>up</code> and runing again, and after third restart it crashed again (it always crashes/exits with status 8).</p>