Skip to content

[bugfix] handle attempt to notify destruction of no-admin channel

  • SYMPTOM: "process destruction requests" job alerts: Error processing destruction jobs: TypeError: Cannot read property 'memberships' of null
  • CAUSE: job is trying to notify admins of channel with no admins.
  • FIX: detect this state and don't attempt to notify

NOTE FOR FUTURE WORK:

the full stack trace is confusing:

`2021-02-12 13:09:12
    at Object.processDestructionRequests (/signalboost/app/registrar/phoneNumber/destroy.js:78:11)
2021-02-12 13:09:12
    at _warnOfPendingDestruction (/signalboost/app/registrar/phoneNumber/destroy.js:104:25)
2021-02-12 13:09:12
    at Array.map (<anonymous>)
2021-02-12 13:09:12
    at /signalboost/app/registrar/phoneNumber/destroy.js:105:16
2021-02-12 13:09:12
    at Object.notifyAdmins (/signalboost/app/notifier.js:34:60)
2021-02-12 13:09:12
    at getAdminMemberships (/signalboost/app/db/repositories/channel.js:180:48)

this suggests that getNotifiableDestructionRequests returns a null field for channel when the channel has no memberhsips, which is what causes getAdminMemberships to throw. we would expect it to return a channel with null memberships or an empty array. a more robust fix would address that issue, but as a stopgap measure, we present this patch and leave documentation to cleanup later.

Merge request reports

Loading