简体   繁体   English

带有云运行和云 Firestore 的 Spring Boot 应用程序

[英]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.

相关问题 Spring 启动 + Cloud Firestore 集成测试 - Spring Boot + Cloud Firestore Integration Tests Google Cloud Run 适合运行 Spring Boot? - Google Cloud Run suitable to run Spring Boot? Spring Boot应用程序未与Cloud Config Server连接 - Spring Boot application not connecting with Cloud Config Server 如何更新/升级 Spring Boot 云应用程序 - How to update/upgrade a spring boot cloud application 无法在云上部署Spring Boot应用程序 - Cannot Deploying spring boot application on cloud Spring Cloud Consul高CPU在Spring Boot应用程序中 - spring cloud consul high cpu in a spring boot application 使用Spring Cloud Starter安全性的404 Not Found Spring Boot应用程序 - 404 Not Found Spring Boot application using spring cloud starter security Spring Cloud 与 Spring Boot 的兼容性 - Spring Cloud Compatibility with Spring Boot 如何使用 spring cloud stream 将 spring boot 应用程序集成到 bluemix cloud 上的 IBM 事件流 - How to integrate a spring boot application using spring cloud stream to IBM event streams on bluemix cloud 在Cloud Foundry上的Docker中启用HTTPS的情况下运行Spring Boot应用程序 - Running Spring Boot application with HTTPS enabled in docker on cloud foundry
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM