http call to external server not working in production BL

it looks like the same problem described in http://support.backendless.com/t/i-have-created-backendless-custom-business-logic-service-which-uses-npm-module-stripe-for-payment but since it’s not updated (although user wrote that problem is still exist) I decided to create my own topic.

I tried with code adapted from documentation https://backendless.com/documentation/business-logic/js/bl_external_hosts.htm

Backendless.enablePromises();
var https = require('https');
Backendless.ServerCode.customEvent('callCurrentRMS2', function(req) {
    var options = {
            hostname: 'api.current-rms.com',
            path: '/api/v1/products/inventory?per_page=20',
            headers: {"X-SUBDOMAIN" : "XXX","X-AUTH-TOKEN" : "XXX"}
        };
    return new Promise((resolve, reject) => {
        https.get(options, (res) => {
            var body = '';
            res.on('data', (chunk) => body += chunk);
            res.on('end', () => {
                console.log(body);
                req.apiCallResult = body;
                resolve({res:body});
            });
            res.resume();
        }).on('error', reject);
    })
    .catch(function(err){
        //Backendless.UserService.logout();//?
        console.log('callCurrentRMS2 err. obj ' + JSON.stringify(err));
        if (err && err.message) return Promise.reject('callCurrentRMS2. Unable to. Got an error: ' + err.message);
        else return Promise.reject('callCurrentRMS2. Unable to. Got an error: ' + JSON.stringify(err));
    });
});

It’s works just fine in debug, but after deploy I only got error {“code”:15000,“message”:“Custom business logic execution has been terminated because it did not complete in permitted time - 20 seconds”,“statusCode”:400}
I also tried with code that uses “request” module - same result.
I enabled external host ‘api.current-rms.com’ (and it is approved)

my appId is DECCC828-2720-F3EA-FFAD-586EEF9BD600

Hi Yuriy,

We’re looking into the problem. It appears the external domain access was not properly configured on the backend after it was approved.

Regards,
Mark

Hi Yuriy,

Could you please check if the BL calls go through now?

Regards,
Mark

Yes, works fine now, thanks!