Skip to content
This repository was archived by the owner on Feb 24, 2026. It is now read-only.
This repository was archived by the owner on Feb 24, 2026. It is now read-only.

Datastore emulator fails to start without project id property #355

Closed

Description

@artemptushkin

Environment details

  1. GCloud datastore emulator 2.1.0
  2. Google Cloud SDK 327.0.0
  3. OS type and version: NAME="Ubuntu" VERSION="18.04.4 LTS (Bionic Beaver)" / MacOS Catalina 10.15.7 (19H15)
  4. Java version: OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.8+10) / OpenJDK Runtime Environment (build 11.0.7+10)
  5. Libs:

Steps to reproduce

This version emulator fails to start without --project property

  1. gcloud beta emulators datastore start
ERROR: (gcloud.beta.emulators.datastore.start) The required property [project] is not currently set.
You may set it for your current workspace by running:

  $ gcloud config set project VALUE

or it can be set temporarily by the environment variable [CLOUDSDK_CORE_PROJECT]

Starting emulator with Java code like this:

LocalDatastoreHelper.create(settings.getConsistency(), settings.getPort());

Causes: no messages in logs, the application failed to call the Datastore then with I/O exceptions, i.e. curl doesn't work.

Workaround

Set env variable: CLOUDSDK_CORE_PROJECT with the projectId value

Questions

  1. Why LocalDatastoreHelper doesn't pass --project on startup and doesn't expect this from the builder?
  2. Shouldn't LocalDatastoreHelper #start fail to start on this kind of errors?

Besides the outcomes of these questions, I would expect this class to fail to start or log something.

Activity

  1. added
    priority: p2Moderately-important priority. Fix may not be included in next release.
    type: questionRequest for information or clarification. Not an issue.
    on Mar 5, 2021
  2. added
    🚨This issue needs some love.
    and removed
    🚨This issue needs some love.
    on Jun 3, 2021
  3. removed their assignment
    on Sep 21, 2021
  4. meredithslota commented on Nov 15, 2021

    @meredithslota

    I wonder if this is an issue with out-dated documentation — https://cloud.google.com/sdk/gcloud/reference/beta/emulators/datastore/start also declares that the--project flag isn't required, but maybe it is now. Are you setting the variables re: the env-init command? It seems like it's expecting a variable like this: DATASTORE_PROJECT_ID=my-project-id (as per this page: https://cloud.google.com/datastore/docs/tools/datastore-emulator#automatically_setting_the_variables).

  5. removed
    priority: p2Moderately-important priority. Fix may not be included in next release.
    🚨This issue needs some love.
    on Nov 15, 2021
  6. artemptushkin commented on Nov 16, 2021

    @artemptushkin
    Author

    @meredithslota I question here particularly LocalDatastoreHelper class and troubleshooting on its start-up issues.

    Consider it starts in an isolated environment without any env variable predefined, then LocalDatastoreHelper starts finishes but the method caller never knows that it failed to start due to missing an env variable, there is no log message.

    As well there is no method in builder to pass the project id explicitly
    image

    I propose:

    • add a method to the builder to pass the project id (if project id is optional it's still good to let you class consumers to pass its value)
    • log when it fails to start due to missing env variable with a reasoning message

    It will make it clear as right now there is no clue to know why it failed to start when no env variable has been provided.

  7. added
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    priority: p2Moderately-important priority. Fix may not be included in next release.
    and removed
    type: questionRequest for information or clarification. Not an issue.
    on Jun 27, 2022
  8. meredithslota commented on Oct 10, 2022

    @meredithslota

    There's a similar issue with the LocalDatastoreHelper googleapis/google-cloud-java#12002 — @prash-mi can you include this with your investigation of the other issue?

  9. jainsahab commented on Nov 23, 2022

    @jainsahab
    Contributor

    @artemptushkin , Thanks for reporting this.

    We have fixed this issue in this PR and is up for review. You can find the explanation and fix in the PR itself.

  10. added a commit that references this issue on Dec 1, 2022
    ef4065d
  11. added a commit that references this issue on Dec 19, 2022
    26e6733
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.api: datastoreIssues related to the googleapis/java-datastore API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions