Skip to content

FCM not working in Prod (working fine in localhost) #1382

@jaysu77

Description

@jaysu77

import * as admin from 'firebase-admin';
admin.initializeApp({
credential: admin.credential.cert({
projectId: ''',
clientEmail: ''',
privateKey:'''
}),
databaseURL: '',
});

export const sendNotificationAll = async (
messageTitle?: string,
messageBody?: string,
topic?: string,
type?: string,
) => {
const message = {
notification: {
title: messageTitle,
body: messageBody,
},
topic: 'test',
};
const response = await admin
.messaging()
.send(message)
.then((response) => {
// Response is a message ID string.
console.log('Successfully sent message:', response);
})
.catch((error) => {
console.log('Error sending message:', error);
});
};
notification coming for localhost or local IP through node API but not working for Production using HTTPS .

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions