fcm/connect/subscribe 404 (not found)
I am receiving this issue in electron app from electron-push-receiver: PUSH_RECEIVER:::Error while starting the service StatusCodeError: 404 - "\n\n \n <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">\n
404. That’s an error.\n
The requested URL /fcm/connect/subscribe was not found on this server. That’s all we know.\n"
at new StatusCodeError (/home/outcode/Projects/aegix-beacon/node_modules/request-promise-core/lib/errors.js:32:15)
at plumbing.callback (/home/outcode/Projects/aegix-beacon/node_modules/request-promise-core/lib/plumbing.js:104:33)
at Request.RP$callback [as _callback] (/home/outcode/Projects/aegix-beacon/node_modules/request-promise-core/lib/plumbing.js:46:31)
at self.callback (/home/outcode/Projects/aegix-beacon/node_modules/request/request.js:185:22)
at Request.emit (node:events:519:28)
at Request.
When I deep dive into the node_modules code, I can see that inside the electron-push-receiver, it is using push-receiver package which is then calling this code in index.js of push-receiver:
const FCM_SUBSCRIBE = 'https://fcm.googleapis.com/fcm/connect/subscribe'; const FCM_ENDPOINT = 'https://fcm.googleapis.com/fcm/send';
module.exports = registerFCM;
async function registerFCM({ senderId, token }) {
const keys = await createKeys();
const response = await request({
url : FCM_SUBSCRIBE,
method : 'POST',
headers : {
'Content-Type' : 'application/x-www-form-urlencoded',
},
form : {
authorized_entity : senderId,
endpoint : ${FCM_ENDPOINT}/${token},
encryption_key : keys.publicKey
.replace(/=/g, '')
.replace(/+/g, '-')
.replace(///g, ''),
encryption_auth : keys.authSecret
.replace(/=/g, '')
.replace(/+/g, '-')
.replace(///g, ''),
},
});
return {
keys,
fcm : JSON.parse(response),
};
}
here when registering the fcm, it is trying to call this url https://fcm.googleapis.com/fcm/connect/subscribe which is no longer available and i am getting 404 which is causing my app not to register a fcm token.
How can this be worked on so that my app can register a fcm token and start getting the push notifications.
Thank you for the help.
@sushan-shrestha were you able to figure this out ?
@sushan-shrestha were you able to figure this out ?
I used firebase-electron to solve the issue. the implementation is somewhat same but we just need to pass more data on:
ipcRenderer.send(START_NOTIFICATION_SERVICE, {
apiKey: apiKey,
appId: appId,
projectId: projectId,
vapidKey: vapidKey,
});
@sushan-shrestha were you able to figure this out ?
Hi, there. try push-recevier-v2.
Thanks I've solved it using firebase-electron