firebase / firebase-admin-node

Firebase Admin Node.js SDK

Home Page:https://firebase.google.com/docs/admin/setup

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Once in a few days i get 401 from APNS

vytautas-pranskunas- opened this issue · comments

I have webhook wich is triggered randomly when users doing some things and sometimes firebase-admin messaging returns 401 when trying to send push. I cannot manualy reproduce it but it in logs.

here is my code

this init function is invoked upon server start in main.ts

const serviceAccount = require('../../../senioassist-fb.json');
export class AuthService {
   static init() {
        admin.initializeApp({
            credential: admin.credential.cert(serviceAccount),
        });
    }
}

and after i have

export class PushNotificationsService {
try {
                await admin.messaging().send(messages[0]);
}} catch (err) {
            var m = messages.map(m => JSON.stringify(m)).join(' ;==============; ');
            errorLoggingService.logError(err, m, ErrorTag.PushNotification);
            isSuccess = false;
        }

any idea?

p.s. i found something similar here: firebase/firebase-functions#579 maybe?

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.