firebase / firebase/firebase-tools
Firestore emulator hangs on calling projects.databases.documents.get with transaction
- Dominant language
- TypeScript
- Stars
- 4.5k
- Forks
- 1.3k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 84
Description
### [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
```
2. Add a document as `users/user0` on Firestore Emulator UI.

3. Begin a new transaction.
```
$ curl -X POST "http://localhost:8080/v1beta1/projects/aaa/databases/(default)/documents:beginTransaction"
{
"transaction": "EQkAAAAAAAAA"
}
```
4. Try to request a document with the transaction.
```
$ curl "http://localhost:8080/v1beta1/projects/aaa/databases/(default)/documents/users/user0?transaction=EQkAAAAAAAAA""
```
5. 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
```
Contributor guide
Assessment
This issue has not been assessed yet.