0

In a shell script execution callback, I'm sending a POST request to a service, but for some reason I get Error: [TypeError: object is not a function]. This is my code:

exec('./scripts/update.sh', function(err, stdout, stderr) {
  if (!err) {
    request('https://api.rollbar.com')
      .post('/api/1/deploy/')
      .send({
        access_token: token,
        environment: 'production',
        revision: commitSHA
      })
      .end(function(err, res) {
        if (!err) {
          console.log('%s: sent deploy information to Rollbar', (new Date()).toLocaleString());
        }
      });
  }
});
Ilan Biala
  • 3,319
  • 5
  • 36
  • 45
  • On what line is the error? What middleware is that `request` coming from – adeneo Feb 22 '15 at 15:43
  • Middleware? The error is from that request line which is really one statement. – Ilan Biala Feb 23 '15 at 04:10
  • Yes, middleware! `request` is a function you're calling, it has to come from somewhere? The most common middleware is [request](https://github.com/request/request), but the syntax is off, so that's not it ? – adeneo Feb 23 '15 at 09:20
  • Sorry it's using `supertest`, I forgot to include that. – Ilan Biala Feb 24 '15 at 04:01

0 Answers0