firebase / firebase/firebase-admin-java

NullPointerException when using cloud messaging

Đang mở
#1,081 3 bình luận 0 reaction 0 người được giao Xem trên GitHub
needs-triage
Ngôn ngữ chính
Java
Star
620
Fork
305
Merge trung bình
3 giờ 23 phút
Pull request đã merge (30 ngày)
1

Mô tả

* Library version: 9.4.3
* Firebase Product: cloud messaging

When we are sending messages in bulk to devices using device specific tokens, we randomly get the error below:

```
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:595)
at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:574)
at com.google.common.util.concurrent.FluentFuture$TrustedFuture.get(FluentFuture.java:91)
at com.google.common.util.concurrent.ForwardingFuture.get(ForwardingFuture.java:67)
at businessLayer.Messaging.sendPush(Messaging.java:777)
...
```

We are using the method sendEachAsync:
`BatchResponse firebaseResponse = FirebaseMessaging.getInstance(firebaseApp).sendEachAsync(firebaseMessages, pushDryRun).get();`

Besides the error showing up randomly when we are sending the messages, it seems that in older version of the library (<= 9.3.0), that the error is:

```
java.util.concurrent.ExecutionException: com.google.firebase.messaging.FirebaseMessagingException: com.google.firebase.messaging.FirebaseMessaging
at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:594)
at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:573)
at com.google.common.util.concurrent.FluentFuture$TrustedFuture.get(FluentFuture.java:91)
at com.google.common.util.concurrent.ForwardingFuture.get(ForwardingFuture.java:67)
at businessLayer.Messaging.sendPush(Messaging.java:777)
...
```

The problem for us is that it seems that this error started showing up randomly last month.
At least some messages seem to be sent, because we have info that users are seeing and clicking on the notifications.
So, it seems that we are correctly calling the procedure.
Any help would be welcomed.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu từ lệnh gọi sendEachAsync và businessLayer.Messaging.sendPush trong Messaging.java:777, sau đó tái hiện việc gửi hàng loạt đến các token dành riêng cho từng thiết bị trên phiên bản thư viện 9.4.3. Truy vết lý do kết quả bất đồng bộ trở thành NullPointerException thay vì FirebaseMessagingException trước đây, đồng thời xác minh rằng các lần gửi hàng loạt báo cáo một lỗi có thể xử lý được trong khi các thông báo gửi thành công vẫn không bị ảnh hưởng.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
firebase, java
Lĩnh vực
backend, cloud
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.