简体   繁体   中英

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. I configured it locally, so I can read and write data to firestore. If I create and run a docker image of the application locally, it works. 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:

java.util.concurrent.ExecutionException: com.google.api.gax.rpc.PermissionDeniedException: io.grpc.StatusRuntimeException: PERMISSION_DENIED: Missing or insufficient permissions.

On cloud, docker image is created with cloud build, through my github repo.

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'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM