Can't make ajax POST calls with an express site running on Heroku

I've recently deployed an express app to heroku which was working fine locally. Now, on heroku, the parts where I make ajax post call are breaking with 500 Internal Server Errors.

In my JS my POST call looks like this:

$.post('/api/', {
  'input': 'input'
}, function(data) {
  if (!data) {
    return console.log('success');
  } else {
    return console.log('failed');
  }
});

And it's treated by express like this (I'm abstracting here):

app.route('/api/')
  .post(function (req, res) {
    var input = req.body.input;

    x.doSomething(input,function (err,data) {
      res.send(err);
    }

  });

After some googling I suspected it might have to do with Access-Control so I added some code to my express app which enabled Access-Control-Origin from everywhere. This stopped the 500 errors and instead caused the post to hang and then timeout after 30 seconds.

I assume this is something to do with Heroku because it's all working fine locally. Any suggestions would be super helpful.

** EDIT **

I've done some more digging and it turns out it's the line var = req.body.input that's causing all the trouble. If I remove this, I don't the 500 error. Another clue, is that in the breakdown of the 500 error, it seems there's some kind of crossDomain sending going on - jquery states in the first line of the error: l.cors.a.crossDomain.send. So something's clearly amiss here and I'm pretty sure it's not to do with the way I've written the ajax call...