[英]Spring boot application with cloud run and cloud firestore
I have a simple spring boot microservice (gradle) that I want to deploy on cloud run and use cloud Firestore for storing some data.我有一个简单的 Spring Boot 微服务(gradle),我想将它部署在云运行上并使用云 Firestore 来存储一些数据。 I configured it locally, so I can read and write data to firestore.
我在本地配置了它,所以我可以读写数据到firestore。 If I create and run a docker image of the application locally, it works.
如果我在本地创建并运行应用程序的 docker 映像,它就可以工作。 When I deploy it on cloud run, the application starts normally,
当我在云运行上部署它时,应用程序正常启动,
except when it tries to read data from firestore (when I call an endpoint), I get the following exception in postman:除了尝试从 firestore 读取数据时(当我调用端点时),我在邮递员中收到以下异常:
java.util.concurrent.ExecutionException: com.google.api.gax.rpc.PermissionDeniedException: io.grpc.StatusRuntimeException: PERMISSION_DENIED: Missing or insufficient permissions.
java.util.concurrent.ExecutionException: com.google.api.gax.rpc.PermissionDeniedException: io.grpc.StatusRuntimeException: PERMISSION_DENIED: 权限缺失或不足。
On cloud, docker image is created with cloud build, through my github repo.在云上,docker 镜像是通过云构建创建的,通过我的 github 存储库。
What should I do to make it work on cloud run?我应该怎么做才能让它在云运行上工作?
I found the problem.我发现了问题。
I followed instructions from this documentation and here it is used this library:我按照本文档中的说明进行操作,这里使用了这个库:
compile 'com.google.cloud:google-cloud-firestore:1.32.0'
Then I tried with this library (this is documentation ) and everything worked!然后我尝试使用这个库(这是文档),一切正常!
implementation 'com.google.firebase:firebase-admin:8.1.0'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.