googleapis / googleapis/google-cloud-java

[java-datastore] Datastore: When using grpc as transport with an emulator, requests are still sent to the google service

未关闭
#11,979 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
api: datastore priority: p3 type: bug
主要语言
Java
星标
2.1k
派生
1.2k
平均合并
1 天 23 小时
30 天内合并 PR
154

描述

2. OS type and version: google-cloud-datastore 2.33.0
4. Java version: openjdk 25

#### Steps to reproduce

1. Start a firestore emulator in datastore mode `gcloud emulators firestore start --database-mode=datastore-mode --host-port "localhost:8082"`
2. Try to connect to it with grpc

#### Code example

```java
DatastoreOptions.newBuilder()
.setHost("localhost:8082")
.setProjectId("project")
.setTransportOptions(GrpcTransportOptions.newBuilder()
.build())
.build()
.getService()
```

The requests will go to the google apis instead of the emulator.

I think the problem is within `com.google.cloud.datastore.spi.v1.GrpcDatastoreRpc`
The lines https://github.com/googleapis/java-datastore/blob/83fb5cffaa091766eb0827921f2549d3e6d98363/google-cloud-datastore/src/main/java/com/google/cloud/datastore/spi/v1/GrpcDatastoreRpc.java#L82-L89 override the channelprovider unconditionally. I think they should only do that, when `isEmulator(datastoreOptions)` is false

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。