Java Admin SDK (in Scala) 5.6.0 for Firestore constantly throws io.grpc.StatusRuntimeException: UNKNOWN

46 views
Skip to first unread message

Sean Eby

unread,
Dec 10, 2017, 10:20:21 AM12/10/17
to Firebase Google Group
Hi everyone,

We have a Play framework application written in Scala consuming the Java Admin SDK 5.6.0 for Firebase. We are using the auth namespace without any issues. Trying to use the FirestoreClient, however, throws the following exception and stacktrace:


ERROR application
- method=GET uri=/v1/users/synchAllUsers remote-address=0:0:0:0:0:0:0:1 status=500 error=class java.util.concurrent.ExecutionException: io.grpc.StatusRuntimeException: UNKNOWN
com
.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)
com
.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:482)
com
.google.api.core.AbstractApiFuture.get(AbstractApiFuture.java:56)
services
.FirebaseAdminService.createToken(FirebaseAdminService.scala:98)
services
.UsersService.$anonfun$synchAllUsers$2(UsersService.scala:37)
scala
.collection.Iterator.foreach(Iterator.scala:929)
scala
.collection.Iterator.foreach$(Iterator.scala:929)
scala
.collection.AbstractIterator.foreach(Iterator.scala:1417)
scala
.collection.IterableLike.foreach(IterableLike.scala:71)
scala
.collection.IterableLike.foreach$(IterableLike.scala:70)
scala
.collection.AbstractIterable.foreach(Iterable.scala:54)
services
.UsersService.$anonfun$synchAllUsers$1(UsersService.scala:34)
services
.UsersService.$anonfun$synchAllUsers$1$adapted(UsersService.scala:34)
scala
.util.Success.$anonfun$map$1(Try.scala:251)
scala
.util.Success.map(Try.scala:209)
scala
.concurrent.Future.$anonfun$map$1(Future.scala:287)
scala
.concurrent.impl.Promise.liftedTree1$1(Promise.scala:29)
scala
.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:29)
scala
.concurrent.impl.CallbackRunnable.run(Promise.scala:60)
akka
.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:55)
akka
.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:91)
scala
.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
scala
.concurrent.BlockContext$.withBlockContext(BlockContext.scala:81)
akka
.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:91)
akka
.dispatch.TaskInvocation.run(AbstractDispatcher.scala:38)
akka
.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:43)
akka
.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
akka
.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
akka
.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
akka
.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)


That same exception is thrown for any read or write action in the Firestore we take. Here is an example code that triggers the exception:

    val userInfoRec = new ImmutableMap.Builder[String, String]()
     
.put("id", user.id.toString)
     
.put("name", user.email)
     
.put("email", user.email)
     
.put("firstName", user.firstName)
     
.put("lastName", user.lastName)
     
.build()


    val users
= db.collection("tenants").get.get


    val result
= db.collection("tenants").document(user.companyId.toString).collection("users").document(user.id.toString).set(userInfoRec)
    result
.get()


The actual exception gets triggered on the call to result.get(). After scouring the documentation, API reference, and generally Googling around for any common issues, we can't seem to find anything. For reference, here is how we are initializing the client:

  private lazy val app = {
   
FirebaseApp.getApps().stream().filter(a => a.getName == FirebaseApp.DEFAULT_APP_NAME).findFirst().orElseGet(
     
() => {
       
//val serviceAccount = new ByteArrayInputStream(Firebase.serviceAccountKey.getBytes(StandardCharsets.UTF_8.name()))
        val serviceAccount
= new FileInputStream("conf/gcp_service_account.json")


        val options
= new FirebaseOptions.Builder()
         
.setCredentials(GoogleCredentials.fromStream(serviceAccount))
         
//.setDatabaseUrl("https://festive-bazaar-146119.firebaseio.com")
         
.build()


        serviceAccount
.close()


       
FirebaseApp.initializeApp(options, FirebaseApp.DEFAULT_APP_NAME)
     
}
   
)
 
}


 
def createToken(user: User, claims: Map[String, Object] = Map()) = {
    val db
= FirestoreClient.getFirestore(app)

   
.... other code follows, including the code snippet mentioned above which causes the exception ...

Does anyone have any ideas on what the issue is? In its current state, the Firestore client API is completely unusable for us.

Thanks,
Sean

Doug Stevenson

unread,
Dec 10, 2017, 3:58:16 PM12/10/17
to Firebase Google Group
Reply all
Reply to author
Forward
0 new messages