firebase-admin-java
firebase-admin-java copied to clipboard
MessagingErrorCode is null on FirebaseMessagingException: The service is currently unavailable
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());
}
});
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
Hey @chutzemischt - are you still encountering this error? We are investigating a similar issue which started for us on July 19th
@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.
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.
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.
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()