GCP Firestore(Datastore mode): Data fetching in SpringBoot using spring-cloud-gcp v4.9.2 throwing an exception

47 Views Asked by At

In one project-id under GCP Firestore, created multiple databases, so there are currently 4 databases in that project, 3 in native mode (default, name2, name3) and 1 in datastore mode (name4). Current requirement is to use the datastore mode database for the springboot microservice as its own database. I am able to define the project-id and database-id correspondingly in the yml properties and define a simple Kind/Entity and Repository interface as mentioned in the documentation (https://googlecloudplatform.github.io/spring-cloud-gcp/reference/html/index.html#spring-data-cloud-datastore). The save is working as expected like. I am able to find the saved record in the GCP console view. But when I am trying to fetch it by an Id(String) the saved record by using findById the call is failing with this below exception message. I have tried injecting databaseid and projectid through bean creation in a configuration class and removed the properties, still got to the same outcome.

  1. SpringBootStarter: 3.1.8

  2. SpringCloudGcp: 4.9.2 (tried different versions same error)

    "The request was for database 'projects/project-id/databases/name4' but was attempting to access database 'projects/project-id/databases/(default)'"

0

There are 0 best solutions below