Update then Transition fail via REST

Hi,

I have a workflow transition with a “field is not empty” validator which works through the UI and also works under certain circumstances in an addon that uses ajax requests to atlassian-connect-express (ace) routes.

Using ace middleware (mw), however, I am trying to update the validated field with one mw function, and then execute the transition with the “next()” function. The transition always returns unfulfilled, as “invalid” for the issue. The app acts as if some additional “commit” step is still incomplete when the transition is attempted.

  function processUpdate(req,res,next) {
    let httpClient = addon.httpClient(req);
    let issuekey   = req.body['issue.key'];
    let body       = JSON.parse(req.body['update.body']);
    let url        = '/rest/api/2/issue/'+issuekey;
    let callback   = function(err, resp, body) {
      console.log(body); // always "undefined" but field  appears to update  successfully everytime 
      next();
    }
    httpClient.asUser('admin').put({url: url,
                                    json: true,
                                    body:body}, callback);
  }

  function processTrans(req,res,next) {
    let httpClient = addon.httpClient(req);
    let issuekey   = req.body['issue.key'];
    let transId    = req.body['trans.id'];
    let body       = { "transition" : { "id" : transId }};
    let url        = '/rest/api/2/issue/'+issuekey+'/transitions';
    let callback   = function(err, resp, body) {
      console.log(body)   // outputs: { errorMessages: [ 'Transition id \'10003\' is not valid for this issue.' ],  errors: {} }
      next();
    }
    httpClient.asUser('admin').post({url: url,
                                     json: true,
                                     body: body },callback)
  }

  app.post('/update', addon.checkValidToken(), processUpdate, processTrans, function(req,res) {
    let result = JSON.stringify({"result":"updates complete"});
    res.json(result);
  });

Any insight you can provide will be most helpful.

Thanks!
Dave