Skip to content

7.0.0

Choose a tag to compare

@alex-friedl alex-friedl released this 29 Nov 21:38
· 13 commits to master since this release

Breaking changes

  • Node.js 24 or later is required.
  • lib/ is gone. The package ships src/ without a build step. Deep imports change from node-pushnotifications/lib/... to node-pushnotifications/src/.... With import, add the .js extension and use the default import.
  • data.recipients is removed and makes send() reject. It never reached FCM. Use topic and condition destinations instead (see below).
  • FCM projectId: if you pass your own credential that isn't a service account credential, for example applicationDefault(), also set settings.fcm.projectId.
  • settings.fcm.httpsAgent is 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 example messaging/unknown-error or app/invalid-credential. send() rejects only when the message can't be built, the credential can't be created from serviceAccountKey, 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 in getApps().
  • Deprecation warning: with serviceAccountKey, firebase-admin prints a fromJSON deprecation warning once per key.
  • Web Push: an invalid endpoint fails that device with ERR_INVALID_URL. WebPushError is now a class, so JSON.stringify drops error.message; use errorMsg.
  • 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-pushnotifications hasn'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.