jlcvp / fcm-node

A Node.JS simple interface to Google's Firebase Cloud Messaging (FCM) for Android & iOS & Web Notification and data push
MIT License
125 stars 46 forks source link

unsubscribeToTopic - SyntaxError: Unexpected token E in JSON at position 0 #92

Closed alialaraby closed 2 years ago

alialaraby commented 2 years ago

here's my situation: I have a bunch of users each of which has an array of topics to subscribe on, i'm iterating over users > topics to subscribe and to unsubscribe the topics.

subscribing is working fine but i'm facing that error when i unsubscribe, also the try/catch has no effect, the app totally crashes.

here's the error:

CB(JSON.parse(e), null);

SyntaxError: Unexpected token E in JSON at position 0 at JSON.parse () at ClientRequest. (...............\node_modules\fcm-node\lib\topic_request.js:24:18) at ClientRequest.emit (node:events:390:28) at ClientRequest.emit (node:domain:475:12) at TLSSocket.socketErrorListener (node:_http_client:447:9) at TLSSocket.emit (node:events:390:28) at TLSSocket.emit (node:domain:475:12) at emitErrorNT (node:internal/streams/destroy:157:8) at emitErrorCloseNT (node:internal/streams/destroy:122:3) at processTicksAndRejections (node:internal/process/task_queues:83:21) [nodemon] app crashed - waiting for file changes before starting...

jlcvp commented 2 years ago

This lib is becoming strongly deprecated and I do not intend to keep the support for it any further, please use the official firebase sdk for node as informed in the readme header.