firebase / firebase-admin-java

Firebase Admin Java SDK
https://firebase.google.com/docs/admin/setup
Apache License 2.0
545 stars 269 forks source link

java.lang.IllegalArgumentException: No enum constant com.google.firebase.ErrorCode.UNIMPLEMENTED #976

Closed gilyeon00 closed 1 month ago

gilyeon00 commented 3 months ago

Hello I'm a user using firebase admin 8.1.0. When I was scheduling push notifications to Jenkins, I saw the following error log

java.lang.IllegalArgumentException: No enum constant com.google.firebase.ErrorCode.UNIMPLEMENTED
    at java.base/java.lang.Enum.valueOf(Enum.java:240)
    at com.google.firebase.messaging.FirebaseMessagingClientImpl$MessagingBatchCallback.createFirebaseException(FirebaseMessagingClientImpl.java:271)
    at com.google.firebase.messaging.FirebaseMessagingClientImpl$MessagingBatchCallback.onFailure(FirebaseMessagingClientImpl.java:258)
    at com.google.firebase.messaging.FirebaseMessagingClientImpl$MessagingBatchCallback.onFailure(FirebaseMessagingClientImpl.java:243)
    at com.google.api.client.googleapis.batch.BatchUnparsedResponse.parseAndCallback(BatchUnparsedResponse.java:209)
    at com.google.api.client.googleapis.batch.BatchUnparsedResponse.parseNextResponse(BatchUnparsedResponse.java:149)
    at com.google.api.client.googleapis.batch.BatchRequest.execute(BatchRequest.java:268)
    at com.google.firebase.messaging.FirebaseMessagingClientImpl.sendBatchRequest(FirebaseMessagingClientImpl.java:138)
    at com.google.firebase.messaging.FirebaseMessagingClientImpl.sendAll(FirebaseMessagingClientImpl.java:118)
    at com.google.firebase.messaging.FirebaseMessaging$2.execute(FirebaseMessaging.java:295)

Previously, I used the sendAll()method, and for some reason, I don't get this error every time. When I looked at ErrorCode.class, there was no UNIMPLEMENTED enum I updated it to 9.2.0 because I thought it might be a version problem.

However, it is written in the 'firebase exception code document' (https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/FirebaseFirestoreException.Code) , but there is no UNIMPLEMENTED enum in both 9.2.0 and 9.3.0 versions

In the end, I heard that sendAll() is not supported in version 9.2.0, so I'm going to use sendEach(), but I think it should still be added to enum. I think it's a critical error in earlier versions of 8.x.x and earlier

I'd appreciate it if you could reflect it for users who might be embarrassed like me. Thank you😀

cgdsyilmaz commented 3 months ago

Same issue as: https://github.com/firebase/firebase-admin-java/issues/974

lahirumaramba commented 2 months ago

sendAll() is deprecated (replaced with sendEach() and will be removed in the upcoming major version. This is why I wasn't sure if it is worth adding this Error code now... we can certainly consider it if folks find this useful though.

CC: @jonathanedey

dsoni768 commented 2 months ago

sendEach method not found

koti-muppavarapu commented 2 months ago

I am facing exact same error now using firebase-admin version 8.2.0.

This worked 100% when I tested last month between 10th August till 16th August. Now suddenly it's not working with error below.

java.lang.IllegalArgumentException: No enum constant com.google.firebase.ErrorCode.UNIMPLEMENTED at java.lang.Enum.valueOf(Enum.java:238) at com.google.firebase.messaging.FirebaseMessagingClientImpl$MessagingBatchCallback.createFirebaseException(FirebaseMessagingClientImpl.java:271) at com.google.firebase.messaging.FirebaseMessagingClientImpl$MessagingBatchCallback.onFailure(FirebaseMessagingClientImpl.java:258) at com.google.firebase.messaging.FirebaseMessagingClientImpl$MessagingBatchCallback.onFailure(FirebaseMessagingClientImpl.java:243) at com.google.api.client.googleapis.batch.BatchUnparsedResponse.parseAndCallback(BatchUnparsedResponse.java:209) at com.google.api.client.googleapis.batch.BatchUnparsedResponse.parseNextResponse(BatchUnparsedResponse.java:149) at com.google.api.client.googleapis.batch.BatchRequest.execute(BatchRequest.java:269) at com.google.firebase.messaging.FirebaseMessagingClientImpl.sendBatchRequest(FirebaseMessagingClientImpl.java:138) at com.google.firebase.messaging.FirebaseMessagingClientImpl.sendAll(FirebaseMessagingClientImpl.java:118) at com.google.firebase.messaging.FirebaseMessaging$2.execute(FirebaseMessaging.java:295) at com.google.firebase.messaging.FirebaseMessaging$2.execute(FirebaseMessaging.java:292) at com.google.firebase.internal.CallableOperation.call(CallableOperation.java:36) at com.google.firebase.messaging.FirebaseMessaging.sendAll(FirebaseMessaging.java:183) at com.google.firebase.messaging.FirebaseMessaging.sendAll(FirebaseMessaging.java:158) at

Below is the my gradle dependency.

implementation 'com.google.firebase:firebase-admin:8.2.0'

Any help with this is greatly appreciated.

gilyeon00 commented 2 months ago

@dsoni768

sendEach 메서드를 찾을 수 없습니다

sendEach() is available in version 9.2.0

gilyeon00 commented 2 months ago

@koti-muppavarapu

지금 firebase-admin 버전 8.2.0을 사용하면서 똑같은 오류가 발생했습니다.

I got into the same problem, so I had no choice but to update it to version 9.2.0 and I had no choice but to write sendEach() I want firebase team to do something for people who are suffering from this problem

koti-muppavarapu commented 2 months ago

@gilyeon00 ,

Really appreciate your feedback on this. I have initially tried using version 9.2.0, but that broke my spring application's startup causing conflicts with logback logging libraries.

Now I have tried using version 9.3.0, with this version at least my application starts fine and sendEach is working fine but the application logging is not working.

The tried version 9.0.0, with this version the application starts fine, logging working fine but sendAll is not working with same error as mentioned above on this thread.

koti-muppavarapu commented 2 months ago

@gilyeon00,

I have addressed the logging issue by exlcuding slf4j-api from the firebase admin dependency. Now using version 9.3.0 and sendEach method the messaging is working fine.

implementation ("com.google.firebase:firebase-admin:$firebaseAdminVersion") {
        exclude group: 'org.slf4j', module: 'slf4j-api'
}
lahirumaramba commented 1 month ago

sendAll(), sendAllAsync(), sendMulticast(), and sendMulticastAsync() APIs were deprecated in v9.2.0. Use sendEach(), sendEachAsync(), sendEachForMulticast(), and sendEachForMulticastAsync() APIs instead.

JasonZhangHG commented 3 weeks ago

中文解释:出现这个问题是新版本的Firebase群发FCM的时候sendAll() 和sendMulticast()已弃用了,大家更换成 sendEach h和sendEachForMulticast() 就可以了

English: The issue arises when using the new version of Firebase for mass FCM, where sendAll() and sendMulticast() are Deprecated. Simply replace them with sendEach h and sendEachForMulticast()