push_notification: Drop notif if ANDROID_FCM_CREDENTIALS_PATH is unset.

If `ANDROID_FCM_CREDENTIALS_PATH` is unset it results in fcm_app=None.
We should log error in this case and return, not doing so will result
in runtime error.

Signed-off-by: Prakhar Pratyush <prakhar@zulip.com>
This commit is contained in:
Prakhar Pratyush
2025-11-03 22:51:35 +05:30
committed by Tim Abbott
parent 06501ab208
commit d893496de1
2 changed files with 47 additions and 0 deletions

View File

@@ -88,6 +88,13 @@ def send_e2ee_push_notification_android(
successfully_sent_count = 0
delete_device_ids: list[int] = []
if fcm_app is None:
logger.error("FCM: Dropping push notifications since ANDROID_FCM_CREDENTIALS_PATH is unset")
return SentPushNotificationResult(
successfully_sent_count=successfully_sent_count,
delete_device_ids=delete_device_ids,
)
try:
batch_response = firebase_messaging.send_each(fcm_requests, app=fcm_app)
except firebase_exceptions.FirebaseError: