我想请求一个仅允许来自香港的IP的API,因此我使用https://ifconfig.co/country-iso进行检查。甚至我按照文档页面(https://firebase.google.com/docs/functions/locations)中的说明设置了functions.region('asia-east2'),控制台也记录了检测到的位置是美国
exports.locationFunction = functions.region('asia-east2').pubsub.schedule('every 1 minutes').onRun((context) => {
request('https://ifconfig.co/country-iso', function (error, response, body) {
console.log("RESULTbody:" + body)
});
return admin.database().ref("mylocation").set("detection finished");
});