Description
Related issues
[REQUIRED] Version info
node: 8
firebase-functions: 7.0.0
firebase-admin: 2.2.0
[REQUIRED] Test case
I run a function every 15 minutes which sends out topic notifications via admin.messaging(), which works extremely well 95% of the time. But just once per day I get authentication error 401 (Unauthorized). It always occurs around the same time 730-930am UTC. I'm using the same global default admin initializeApp().
If there is a way to determine the admin auth status or if a cold start is required, then I might be able to re-intialise before the error?
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp();
exports.indicatorsUpdated_15m = functions.firestore.document('indicators/15m').onWrite((change, context) => {
// topic notification code: eg. admin.messaging().sendToTopic()
});
[REQUIRED] Steps to reproduce
Described in test case
[REQUIRED] Expected behavior
No authentication error, and notifications get sent as normal same as other 95% of the day.
[REQUIRED] Actual behavior
Returns auth error, and notifications do not get sent for this one 15 minute window, and it results in a cold restart taking 15-30 seconds.