firebase-tools icon indicating copy to clipboard operation
firebase-tools copied to clipboard

Firestore emulator hangs on calling projects.databases.documents.get with transaction

Open IzumiSy opened this issue 3 years ago • 5 comments

[REQUIRED] Environment info

firebase-tools: 9.4.4

Platform: MacOS Catalina 10.15.7, Node.js v14.15.4

[REQUIRED] Test case

N/A

[REQUIRED] Steps to reproduce

  1. Launches an emulator
$ npx firebase emulators:start --only firestore --project aaa
  1. Add a document as users/user0 on Firestore Emulator UI.
スクリーンショット 2021-04-20 21 43 03
  1. Begin a new transaction.
$ curl -X POST "http://localhost:8080/v1beta1/projects/aaa/databases/(default)/documents:beginTransaction"
{
  "transaction": "EQkAAAAAAAAA"
}
  1. Try to request a document with the transaction.
$ curl "http://localhost:8080/v1beta1/projects/aaa/databases/(default)/documents/users/user0?transaction=EQkAAAAAAAAA""
  1. Now, it finally hangs.

[REQUIRED] Expected behavior

The requested document should be responded successfully.

[REQUIRED] Actual behavior

java.lang.IllegalArgumentException: Unmapped JavaType: BYTE_STRING is thrown at step 5 in a test case.

Full logs:

Apr 20, 2021 9:34:26 PM com.google.cloud.datastore.emulator.firestore.websocket.WebSocketServer start
INFO: Started WebSocket server on ws://localhost:57780
API endpoint: http://localhost:8080
If you are using a library that supports the FIRESTORE_EMULATOR_HOST environment variable, run:

   export FIRESTORE_EMULATOR_HOST=localhost:8080

Dev App Server is now running.

Apr 20, 2021 9:34:36 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected non-HTTP/2 connection.
Apr 20, 2021 9:34:37 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected non-HTTP/2 connection.
Apr 20, 2021 9:34:37 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected non-HTTP/2 connection.
Apr 20, 2021 9:34:42 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected non-HTTP/2 connection.
Apr 20, 2021 9:34:42 PM com.google.cloud.datastore.emulator.firestore.webchannel.FirestoreV1WebChannelAdapter$FirestoreListenHandler onClose
INFO: channel closed
Apr 20, 2021 9:34:52 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected non-HTTP/2 connection.
Apr 20, 2021 9:34:52 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected HTTP/2 connection.
Apr 20, 2021 9:35:07 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected non-HTTP/2 connection.
Apr 20, 2021 9:35:07 PM io.netty.channel.DefaultChannelPipeline onUnhandledInboundException
WARNING: An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
java.lang.IllegalArgumentException: Unmapped JavaType: BYTE_STRING
	at io.gapi.emulators.grpc.HttpAdapter.toJavaType(HttpAdapter.java:313)
	at io.gapi.emulators.grpc.HttpAdapter.setFieldValues(HttpAdapter.java:378)
	at io.gapi.emulators.grpc.HttpAdapter.mergeFields(HttpAdapter.java:331)
	at io.gapi.emulators.grpc.HttpAdapter$StubMethodHandler.handle(HttpAdapter.java:511)
	at io.gapi.emulators.grpc.HttpAdapter$UnaryMethodHandler.handle(HttpAdapter.java:573)
	at io.gapi.emulators.grpc.HttpAdapter.handleRequest(HttpAdapter.java:196)
	at io.gapi.emulators.netty.HttpHandler.channelRead(HttpHandler.java:52)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
	at com.google.cloud.datastore.emulator.firestore.CloudFirestore$ContentTypeWorkaroundHandler.channelRead0(CloudFirestore.java:272)
	at com.google.cloud.datastore.emulator.firestore.CloudFirestore$ContentTypeWorkaroundHandler.channelRead0(CloudFirestore.java:257)
	at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
	at io.gapi.emulators.netty.SimpleHttpHandler.channelRead(SimpleHttpHandler.java:102)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
	at io.gapi.emulators.netty.HttpHandler$1.onValue(HttpHandler.java:64)
	at io.gapi.emulators.netty.HttpHandler$1.onValue(HttpHandler.java:54)
	at com.google.cloud.datastore.emulator.firestore.HttpHtmlAdapter.handleRequest(HttpHtmlAdapter.java:45)
	at io.gapi.emulators.netty.HttpHandler.channelRead(HttpHandler.java:52)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
	at io.gapi.emulators.netty.SimpleHttpHandler.channelRead(SimpleHttpHandler.java:102)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
	at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
	at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
	at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324)
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:61)
	at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:370)
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at java.lang.Thread.run(Thread.java:748)

*** shutting down gRPC server since JVM is shutting down
*** server shut down

IzumiSy avatar Apr 20 '21 12:04 IzumiSy

This also happens in projects.databases.documents.list

IzumiSy avatar Apr 21 '21 13:04 IzumiSy

Have you found any workaround for this? I'm running into the same issue.

DavidDTA avatar Feb 26 '22 01:02 DavidDTA

No, I haven't. I am still waiting for getting this issue fixed.

IzumiSy avatar Feb 27 '22 12:02 IzumiSy

Hi, thanks for filing this issue! We are unable to promise any timeline for this, but if others also have this issue, adding a +1 on this issue can help us prioritize adding this to the roadmap.

(Googler-only internal tracking bug: b/222165794)

yuchenshi avatar Mar 02 '22 00:03 yuchenshi

Being able to run integration tests against features that require strong consistency is a must-have. Without this the emulator is just a key-value store and the most important feature of Firestore cannot be tested. I might as well just use Redis.

When can you get this fixed?

mgiuliano avatar Aug 08 '22 14:08 mgiuliano