Timing out on passport.authenticate, no idea why

When I POST to the endpoint that calls passport.authenticate, I get no response, nor does the server proceed to the strategy defined in passport.use. On Heroku, I get error H12 (timeout), and locally my browser responds with "No data received."

I made a checkin to GitHub with the code that has this problem.

This isn't a database problem – a console.log is called before .findOne, but that message is never logged. It just seems to stop at passport.authenticate. Why?

What's going on here? Is there something else I can do to diagnose?

Turns out passport.authenticate(…) returns a middleware-style function.

I broke the response chain by calling it the wrong way. In my site.js module, exports.login should be set to the result of passport.authenticate(…), it should not call it, i.e.:

exports.login = passport.authenticate('local', {
  successRedirect: '/result',
  failureRedirect: '/login'
});

Try changing line 38 of app.js to either:

User.findOne({ id: id }, ...)

or

User.findById(id, ...)