firebase-admin-java icon indicating copy to clipboard operation
firebase-admin-java copied to clipboard

MessagingErrorCode is null on FirebaseMessagingException: The service is currently unavailable

Open chutzemischt opened this issue 2 years ago • 4 comments

Environment

  • Firebase SDK version: 9.0.0
  • Firebase Product: cloud messaging

Problem

The SendResponse of a MulticastMessage contains a com.google.firebase.messaging.FirebaseMessagingException: The service is currently unavailable exception, but the MessagingErrorCode is null.

Excpected behaviour

Exception contains the error code MessagingErrorCode.UNAVAILABLE.

Steps to reproduce:

Get exception of a SendResponse after sending a MulticastMessage.

Relevant Code:

BatchResponse batchResponse = FirebaseMessaging.getInstance().sendMulticast(message);
batchResponse.getResponses().forEach(response -> {
    if (!response.isSuccessful()) {
        log.warn("Failed to send message. ErrorCode: {}", response.getException().getMessagingErrorCode(), response.getException());
    }
});

chutzemischt avatar Jul 25 '22 13:07 chutzemischt

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

google-oss-bot avatar Jul 25 '22 13:07 google-oss-bot

Hey @chutzemischt - are you still encountering this error? We are investigating a similar issue which started for us on July 19th

julianD77 avatar Aug 05 '22 11:08 julianD77

@julianD77 Yes, we still receive the error from time to time. The exception itself is not a problem for us. The problem is that the error code of the exception is null and therefore we can't properly handle the exception.

chutzemischt avatar Aug 08 '22 09:08 chutzemischt

I am also encountering a increasing number of MessagingErrorCode is null.

Currently in my log, every million of push messages will have about 100 to 200 of MessagingErrorCode is null, and I cannot be able to distinguish that I should resend these messages or not, because it is not either INTERNAL or UNAVAILABLE.

meor9zcu12 avatar Aug 09 '22 02:08 meor9zcu12

Closing this for now as it has been a while since the last issue was reported and assuming that the BE service should be working now. We can reopen if you are still experiencing this issue.

lahirumaramba avatar Dec 19 '22 22:12 lahirumaramba

I have got same result while testing error codes from SDK. If I mocked FCM server and returned 503 error, I received exception FirebaseMessagingException with null in getMessagingErrorCode, because 503 return null in response context.

Just try to receive error from .getErrorCode() not from .getMessagingErrorCode()

denispershin avatar Feb 16 '24 14:02 denispershin