Repository navigation
7.0.0
Breaking changes
- Node.js 24 or later is required.
lib/is gone. The package shipssrc/without a build step. Deep imports change fromnode-pushnotifications/lib/...tonode-pushnotifications/src/.... Withimport, add the.jsextension and use the default import.data.recipientsis removed and makessend()reject. It never reached FCM. Use topic and condition destinations instead (see below).- FCM
projectId: if you pass your owncredentialthat isn't a service account credential, for exampleapplicationDefault(), also setsettings.fcm.projectId. settings.fcm.httpsAgentis no longer passed to Firebase. It never had an effect.
New
FCM topics and conditions, passed as destinations:
await push.send(
[
{ type: 'fcm', topic: 'news' },
{ type: 'fcm', condition: "'news' in topics && 'sports' in topics" },
],
data
);Each one gets an entry in the FCM result with its message ID. See Topics and conditions.
Changes you may notice
- FCM errors: network and credential errors appear as failed entries in
message[], for examplemessaging/unknown-errororapp/invalid-credential.send()rejects only when the message can't be built, the credential can't be created fromserviceAccountKey, or the project ID is missing. - Multi-chunk failures: when one batch of a large FCM send fails,
send()rejects after all batches have finished, with the error of the first failing batch. - Firebase apps: each send creates a Firebase app named
<appName>:<uuid>and deletes it afterwards. While a send runs, the app shows up ingetApps(). - Deprecation warning: with
serviceAccountKey, firebase-admin prints afromJSONdeprecation warning once per key. - Web Push: an invalid endpoint fails that device with
ERR_INVALID_URL.WebPushErroris now a class, soJSON.stringifydropserror.message; useerrorMsg. - Jest: without
--experimental-vm-modules, the library loads, but an unmocked web push send rejects, because web-push 4 is ESM-only. - TypeScript:
@types/node-pushnotificationshasn't been updated for 7.0 yet. Topic destinations need a cast.
Dependencies
firebase-admin 14 and web-push 4. npm audit on a fresh install drops from 11 findings to 3. The remaining three come from node-forge through @parse/node-apn and don't affect the parts node-apn uses.