I'm calling a third party API to send transactional SMS to the mobile numbers. While executing the function by calling from the android client, the function execution gives the code 200. But the log text shows ignoring exception from the finished function. I have seen many questions about this. None of them solved my problem and non-related to my problem.
'use-strict'
var admin = require("firebase-admin");
var functions = require('firebase-functions');
var serviceAccount = require("./ServiceKey.json");
var http = require("http");
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: "https://atithikhana2.firebaseio.com/"
});
var options = {
"method": "POST",
"hostname": "2factor.in",
"port": null,
"path": "/API/V1/b5b8cefe-d3f8-11e9-ade6-0200cd936042/ADDON_SERVICES/SEND/TSMS",
"headers": {}
};
exports.sendTNS = functions.https.onCall((data, context) => {
const var1 = data.var1;
const var2 = data.var2;
const var3 = data.var3;
const var4 = data.var4;
const phone_number = data.phone_number;
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({ From: 'AKINFO',
To: 'phone_number',
TemplateName: 'Customer_Template',
VAR1: 'var1',
VAR2: 'var2',
VAR3: 'var3',
vAR4: 'var4'}));
req.end();
});
6:02:24.911 PM
sendTNS
Function execution started
6:02:24.911 PM
sendTNS
Billing account not configured. External network is not accessible and quotas are severely limited. Configure billing account to remove these restrictions
6:02:24.917 PM
sendTNS
Function execution took 7 ms, finished with status code: 200
6:02:24.926 PM
sendTNS
Ignoring exception from a finished function