business logic working on debug but not on production

Hi simone

Could you try to wrap your code with Promise


Backendless.ServerCode.Persistence.afterCreate('YourTableName', function(req, res) {


  return new Promise(function(resolve, reject) {


    if (req.error) {
      reject(req.error)
      
    } else {


      var successCallback = function() {


        //do something


        resolve(res.result)
      }


      //do something
    }


  })
});


Regards, Vlad

also it should explain you some points https://github.com/Backendless/JS-Code-Runner/blob/master/docs/Troubleshooting.md#servercode-works-well-in-the-debug-mode-but-does-not-when-deployed-to-the-cloud