Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Datastore UI is not working with datastore in firestore mode #14

Open
sebastian-filip opened this issue Jun 24, 2024 · 3 comments
Open

Comments

@sebastian-filip
Copy link

sebastian-filip commented Jun 24, 2024

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?

@remko
Copy link
Owner

remko commented Jun 24, 2024

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.

@jmhobbs
Copy link

jmhobbs commented Jun 25, 2024

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.

@sebastian-filip
Copy link
Author

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants