I´m trying to use Firebase Cloud Message to send notifications through Firebase Cloud Functions. So i´ve deployed a function on Cloud Functions which calls the function admin.sendMessageToTopic(), but I´m getting the warning:
"Billing account not configured. External network is not accessible and quotas are severely limited. Configure billing account to remove these restrictions"
after this, the function proceeds with no error, but the Cloud Message doesn´t send the Message.
Here is the code which i´m getting this error:
exports.sendMessageToTopic = functions.https.onRequest((req, res) => {
const topic = req.query.topic
const title = req.query.title
const body = req.query.body
const message = {
data: {
title: title,
body: body
}
}
admin.messaging().sendToTopic(topic , message)
.then(result => {
console.log("sendMessageToTopic ok:", result)
res.send("sendMessageToTopic ok")
})
.catch(error => {
console.log("sendMessageToTopic ERROR:", error)
res.send("sendMessageToTopic ERROR: " + error)
})
})
If you guys know what should be the problem, please share the solution with us. Thank you guys.