remko/dsadmin

Datastore UI is not working with datastore in firestore mode

sebastian-filip opened this issue · 3 comments

I am trying to make the UI work with datastore in firestore mode. This is my docker-compose.yaml

version: "3.9"
services:
  # DSAdmin container
  dsadmin:
    image: "ghcr.io/remko/dsadmin:latest"
    depends_on:
      - datastore
    ports:
      - "3334:8080"
    environment:
      DATASTORE_PROJECT_ID: "project-dev"
      DATASTORE_EMULATOR_HOST: "datastore:3333"

  # Datastore Emulator container
  datastore:
    image: "gcr.io/google.com/cloudsdktool/google-cloud-cli:latest"
    volumes:
      - datastore_data:/opt/datastore/data
    ports:
      - "3333:3333"
    command: [
      "gcloud", "emulators", "firestore", "start","--database-mode=datastore-mode", "--host-port=0.0.0.0:3333"
    ]
    environment:
      CLOUDSDK_CORE_PROJECT: "project-dev"

volumes:
  datastore_data:

But for some reason I keep on getting this Error.

image

What can I do about it?

Good question. I have not tried the firestore emulator yet, I always use the datastore emulator.

From your error message, it sounds like it doesn't support the (metadata) queries that dsadmin does to list the namespaces and kinds available in the database. I would have to check whether there is a replacement for this in the firestore emulator.

Bumped into this as well, it looks like it is in fact a limitation of the Firestore emulator in datastore mode,

[firestore] Jun 25, 2024 12:55:45 AM io.gapi.emulators.netty.HttpHandler$1 onError
[firestore] INFO: Exception when handling request: INVALID_ARGUMENT: Kind queries are not supported in the Datastore Mode emulator.

I could not find any docs stating this limitation though, nor any tickets on issuetracker.google.com.

I switched to the datastore emulator with the --use-firestore-in-datastore-mode flag on and it's working for my use case.

Thank you guys for your feedback.

The only issue I have is that I keep on getting the same error Filter has 4 properties, expected 1 whenever I try to use the IN filter. It seems that with firestore the issue is gone, and IN filtering works as expected.

This is also the solution Google is recommending for filtering.

@jmhobbs I tried now to use --use-firestore-in-datastore-mode such as:

DSAdmin container
dsadmin:
image: "ghcr.io/remko/dsadmin:latest"
depends_on:
- datastore
ports:
- "3334:8080"
environment:
DATASTORE_PROJECT_ID: "project-dev"
DATASTORE_EMULATOR_HOST: "datastore:3333"

Datastore Emulator container
datastore:
image: "gcr.io/google.com/cloudsdktool/google-cloud-cli:latest"
volumes:
- datastore_data:/opt/datastore/data
ports:
- "3333:3333"
command: [
"gcloud", "--quiet", "beta", "emulators", "datastore", "start", "--use-firestore-in-datastore-mode",
      "--no-store-on-disk", "--data-dir=/opt/datastore/data", "--host-port=0.0.0.0:3333"
]
environment:
CLOUDSDK_CORE_PROJECT: "project-dev"

volumes:
datastore_data:

And I keep getting the same error for IN filtering.

Screenshot 2024-06-25 at 08 33 21

Does this work for you, or was this happening for you as well? How do you guys manage to do IN, !=, and NOT-IN queries?