简体   繁体   中英

Hosting Node with Heroku - Internal Server Error

Im trying to host a Node + Express app with Heroku however when I try to render a view I get an "Internal Server Error"

The connection to Redis works fine.

app.configure(function(){
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(app.router);
app.use(express.static(__dirname + '/public'));
});


app.get('/', function(req, res) {   
redis.get('foo', function(err, value){
    res.render('index', { title: 'My App', Order: value }); -> This Line Fails
    console.log(value); 
});

});

Loggly Logs:

2011 Nov 14 20:09:42.649 50.19.0.98 126: <40>1 2011-11-14T20:09:42+00:00 d.0bd0cf5e-9521-4fd5-8d4a-b8fcf757e5bf heroku web.1 - - State changed from bouncing to created
2011 Nov 14 20:09:42.669 50.19.0.98 126: <40>1 2011-11-14T20:09:42+00:00 d.0bd0cf5e-     9521-4fd5-8d4a-b8fcf757e5bf heroku web.1 - - State changed from created to starting
2011 Nov 14 20:09:44.531 50.17.63.134 131: <40>1 2011-11-14T20:09:44+00:00 d.0bd0cf5e-  9521-4fd5-8d4a-b8fcf757e5bf heroku web.1 - - Starting process with command `node app.js`
2011 Nov 14 20:09:44.913 50.17.63.134 123: <13>1 2011-11-14T20:09:44+00:00 d.0bd0cf5e-9521-4fd5-8d4a-b8fcf757e5bf app web.1 - -    [36minfo  -[39m socket.io started
2011 Nov 14 20:09:44.938 50.17.63.134 142: <13>1 2011-11-14T20:09:44+00:00 d.0bd0cf5e-9521-4fd5-8d4a-b8fcf757e5bf app web.1 - - Express server listening on port 27910 in production mode
2011 Nov 14 20:09:45.763 50.19.0.98 121: <40>1 2011-11-14T20:09:45+00:00 d.0bd0cf5e-9521-4fd5-8d4a-b8fcf757e5bf heroku web.1 - - State changed from starting to up
2011 Nov 14 20:09:53.510 184.73.5.216 121: <40>1 2011-11-14T20:09:53+00:00 d.0bd0cf5e-9521-4fd5-8d4a-b8fcf757e5bf heroku api - - Scale to web=1 by ****@gmail.com
2011 Nov 14 20:09:56.027 50.17.63.134 96: <13>1 2011-11-14T20:09:56+00:00 d.0bd0cf5e-9521-4fd5-8d4a-b8fcf757e5bf app web.1 - - 1,2,3,4,5,6
2011 Nov 14 20:09:56.029 50.17.63.134 281: <13>1 2011-11-14T20:09:56+00:00 d.0bd0cf5e-  9521-4fd5-8d4a-b8fcf757e5bf app web.1 - - 10.108.67.105 - - [Mon, 14 Nov 2011 20:09:56 GMT]   "GET / HTTP/1.1" 200 - "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.120 Safari/535.2"
2011 Nov 14 20:09:56.029 50.17.63.134 97: <13>1 2011-11-14T20:09:56+00:00 d.0bd0cf5e-9521-4fd5-8d4a-b8fcf757e5bf app web.1 - - Served Index
2011 Nov 14 20:09:56.144 184.73.5.216 178: <158>1 2011-11-14T20:09:56+00:00 d.0bd0cf5e-9521-4fd5-8d4a-b8fcf757e5bf heroku router - - GET rtcubes.herokuapp.com/ dyno=web.1 queue=0 wait=11ms service=45ms status=200 bytes=21
2011 Nov 14 20:10:05.337 50.17.63.134 281: <13>1 2011-11-14T20:10:05+00:00 d.0bd0cf5e-9521-4fd5-8d4a-b8fcf757e5bf app web.1 - - 10.217.29.248 - - [Mon, 14 Nov 2011 20:10:05 GMT] "GET / HTTP/1.1" 200 - "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.120 Safari/535.2"
2011 Nov 14 20:10:05.337 50.17.63.134 97: <13>1 2011-11-14T20:10:05+00:00 d.0bd0cf5e-9521-4fd5-8d4a-b8fcf757e5bf app web.1 - - Served Index
2011 Nov 14 20:10:05.337 50.17.63.134 96: <13>1 2011-11-14T20:10:05+00:00 d.0bd0cf5e-9521-4fd5-8d4a-b8fcf757e5bf app web.1 - - 1,2,3,4,5,6
2011 Nov 14 20:10:56.123 50.17.63.134 97: <13>1 2011-11-14T20:10:56+00:00 d.0bd0cf5e-9521-4fd5-8d4a-b8fcf757e5bf app web.1 - - Served Index
2011 Nov 14 20:10:56.125 50.17.63.134 281: <13>1 2011-11-14T20:10:56+00:00 d.0bd0cf5e-9521-4fd5-8d4a-b8fcf757e5bf app web.1 - - 10.217.17.204 - - [Mon, 14 Nov 2011 20:10:56 GMT] "GET / HTTP/1.1" 200 - "-

I had a similar problem. Figured out I was requesting a wrong page. Fixed.

解决此问题的方法是,我使用Heroku CLI从本地计算机部署了该应用程序(而不是像以前那样从GitHub部署了该应用程序)

I have fixed the issue, Destroyed the app and recreated it on heroku and it just worked. Must have been a configuration problem.

Thanks

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM