Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fcm/connect/subscribe 404 (not found) #99

Open
sushan-shrestha opened this issue Nov 26, 2024 · 1 comment
Open

fcm/connect/subscribe 404 (not found) #99

sushan-shrestha opened this issue Nov 26, 2024 · 1 comment

Comments

@sushan-shrestha
Copy link

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 <title>Error 404 (Not Found)!!1</title>\n <style>\n {margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px} > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}\n </style>\n \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. (/home/outcode/Projects/aegix-beacon/node_modules/request/request.js:1154:10)
at Request.emit (node:events:519:28)
at IncomingMessage. (/home/outcode/Projects/aegix-beacon/node_modules/request/request.js:1076:12)
at Object.onceWrapper (node:events:633:28)
at IncomingMessage.emit (node:events:531:35)
at endReadableNT (node:internal/streams/readable:1696:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
statusCode: 404,
....

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.

@brightchamps-dev
Copy link

@sushan-shrestha were you able to figure this out ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants