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 emulator fails to start without project id property #355

Closed
artemptushkin opened this issue Mar 1, 2021 · 4 comments · Fixed by #923
Closed

Datastore emulator fails to start without project id property #355

artemptushkin opened this issue Mar 1, 2021 · 4 comments · Fixed by #923
Assignees
Labels
api: datastore Issues related to the googleapis/java-datastore API. priority: p2 Moderately-important priority. Fix may not be included in next release. 🚨 This issue needs some love. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@artemptushkin
Copy link

artemptushkin commented Mar 1, 2021

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.

@product-auto-label product-auto-label bot added the api: datastore Issues related to the googleapis/java-datastore API. label Mar 1, 2021
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Mar 2, 2021
@dmahugh dmahugh added priority: p2 Moderately-important priority. Fix may not be included in next release. type: question Request for information or clarification. Not an issue. labels Mar 5, 2021
@yoshi-automation yoshi-automation removed the triage me I really want to be triaged. label Mar 5, 2021
@yoshi-automation yoshi-automation added 🚨 This issue needs some love. and removed 🚨 This issue needs some love. labels Jun 3, 2021
@crwilcox crwilcox removed their assignment Sep 21, 2021
@yoshi-automation yoshi-automation added the 🚨 This issue needs some love. label Nov 3, 2021
@meredithslota
Copy link

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).

@meredithslota meredithslota removed priority: p2 Moderately-important priority. Fix may not be included in next release. 🚨 This issue needs some love. labels Nov 15, 2021
@artemptushkin
Copy link
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.

@meredithslota meredithslota added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p2 Moderately-important priority. Fix may not be included in next release. and removed type: question Request for information or clarification. Not an issue. labels Jun 27, 2022
@yoshi-automation yoshi-automation added the 🚨 This issue needs some love. label Jun 27, 2022
@meredithslota
Copy link

There's a similar issue with the LocalDatastoreHelper #302@prash-mi can you include this with your investigation of the other issue?

@jainsahab
Copy link
Member

@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.

jainsahab added a commit that referenced this issue Dec 1, 2022
#923)

* Running gcloud datastore emulator with --project argument

* Allow user to pass a custom project id when creating a new LocalDatastoreHelper instance

* Creating a local variable to increase the readability and emphasizing on the fact that project id not nullable now

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
gcf-merge-on-green bot pushed a commit that referenced this issue Dec 6, 2022
🤖 I have created a release *beep* *boop*
---


## [2.13.0](https://togithub.com/googleapis/java-datastore/compare/v2.12.5...v2.13.0) (2022-12-06)


### Features

* Next release from main branch is 2.13.0 ([#917](https://togithub.com/googleapis/java-datastore/issues/917)) ([1f12435](https://togithub.com/googleapis/java-datastore/commit/1f1243577cbdc206b6a0bfcde818411eb1b806ad))


### Bug Fixes

* [#355](https://togithub.com/googleapis/java-datastore/issues/355) Explicitly passing --project argument when starting emulator ([#923](https://togithub.com/googleapis/java-datastore/issues/923)) ([ef4065d](https://togithub.com/googleapis/java-datastore/commit/ef4065d233b968f58a34673aa53d39f60a013e2d))


### Dependencies

* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.1.0 ([#932](https://togithub.com/googleapis/java-datastore/issues/932)) ([1dbcea7](https://togithub.com/googleapis/java-datastore/commit/1dbcea73827961148800c1ec8e87065dbceb6c88))
* Update dependency org.graalvm.buildtools:junit-platform-native to v0.9.18 ([#924](https://togithub.com/googleapis/java-datastore/issues/924)) ([625e896](https://togithub.com/googleapis/java-datastore/commit/625e89685172ae546a813f5f7184223d01fbb0ac))
* Update dependency org.graalvm.buildtools:junit-platform-native to v0.9.19 ([#930](https://togithub.com/googleapis/java-datastore/issues/930)) ([77285be](https://togithub.com/googleapis/java-datastore/commit/77285be97fbd6bca1ada35202842238e306dd8dc))
* Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.18 ([#925](https://togithub.com/googleapis/java-datastore/issues/925)) ([0c7539d](https://togithub.com/googleapis/java-datastore/commit/0c7539d736ec993d7bb0531d7cd4dab1b08487a0))
* Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.19 ([#931](https://togithub.com/googleapis/java-datastore/issues/931)) ([40b4011](https://togithub.com/googleapis/java-datastore/commit/40b4011e3a826a91e33541efdecb05f0e129f87c))

---
This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
triplequark pushed a commit that referenced this issue Dec 19, 2022
* chore: upgrade native image checks to graalvm-22.3.0  (#1718) (#926)

chore: upgrade native image checks to graalvm-22.3.0
Source-Link: googleapis/synthtool@5e52896
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-java:latest@sha256:27b1b1884dce60460d7521b23c2a73376cba90c0ef3d9f0d32e4bdb786959cfd

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>

* chore: add new branch to sync-repo-settings (#927)

* fix: #355 Explicitly passing --project argument when starting emulator (#923)

* Running gcloud datastore emulator with --project argument

* Allow user to pass a custom project id when creating a new LocalDatastoreHelper instance

* Creating a local variable to increase the readability and emphasizing on the fact that project id not nullable now

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>

* build(deps): update dependency com.google.cloud:google-cloud-shared-config to v1.5.5 (#929)

* deps: update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.19 (#931)

* deps: update dependency org.graalvm.buildtools:junit-platform-native to v0.9.19 (#930)

* deps: update dependency com.google.cloud:google-cloud-shared-dependencies to v3.1.0 (#932)

* chore(main): release 2.13.0 (#921)

:robot: I have created a release *beep* *boop*
---


## [2.13.0](https://togithub.com/googleapis/java-datastore/compare/v2.12.5...v2.13.0) (2022-12-06)


### Features

* Next release from main branch is 2.13.0 ([#917](https://togithub.com/googleapis/java-datastore/issues/917)) ([1f12435](https://togithub.com/googleapis/java-datastore/commit/1f1243577cbdc206b6a0bfcde818411eb1b806ad))


### Bug Fixes

* [#355](https://togithub.com/googleapis/java-datastore/issues/355) Explicitly passing --project argument when starting emulator ([#923](https://togithub.com/googleapis/java-datastore/issues/923)) ([ef4065d](https://togithub.com/googleapis/java-datastore/commit/ef4065d233b968f58a34673aa53d39f60a013e2d))


### Dependencies

* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.1.0 ([#932](https://togithub.com/googleapis/java-datastore/issues/932)) ([1dbcea7](https://togithub.com/googleapis/java-datastore/commit/1dbcea73827961148800c1ec8e87065dbceb6c88))
* Update dependency org.graalvm.buildtools:junit-platform-native to v0.9.18 ([#924](https://togithub.com/googleapis/java-datastore/issues/924)) ([625e896](https://togithub.com/googleapis/java-datastore/commit/625e89685172ae546a813f5f7184223d01fbb0ac))
* Update dependency org.graalvm.buildtools:junit-platform-native to v0.9.19 ([#930](https://togithub.com/googleapis/java-datastore/issues/930)) ([77285be](https://togithub.com/googleapis/java-datastore/commit/77285be97fbd6bca1ada35202842238e306dd8dc))
* Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.18 ([#925](https://togithub.com/googleapis/java-datastore/issues/925)) ([0c7539d](https://togithub.com/googleapis/java-datastore/commit/0c7539d736ec993d7bb0531d7cd4dab1b08487a0))
* Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.19 ([#931](https://togithub.com/googleapis/java-datastore/issues/931)) ([40b4011](https://togithub.com/googleapis/java-datastore/commit/40b4011e3a826a91e33541efdecb05f0e129f87c))

---
This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).

* chore(deps): update dependency com.google.cloud:google-cloud-datastore to v2.13.0 (#935)

[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [com.google.cloud:google-cloud-datastore](https://togithub.com/googleapis/java-datastore) | `2.12.5` -> `2.13.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-datastore/2.13.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-datastore/2.13.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-datastore/2.13.0/compatibility-slim/2.12.5)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-datastore/2.13.0/confidence-slim/2.12.5)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>googleapis/java-datastore</summary>

### [`v2.13.0`](https://togithub.com/googleapis/java-datastore/blob/HEAD/CHANGELOG.md#&#8203;2130-httpsgithubcomgoogleapisjava-datastorecomparev2125v2130-2022-12-06)

[Compare Source](https://togithub.com/googleapis/java-datastore/compare/v2.12.5...v2.13.0)

##### Features

-   Next release from main branch is 2.13.0 ([#&#8203;917](https://togithub.com/googleapis/java-datastore/issues/917)) ([1f12435](https://togithub.com/googleapis/java-datastore/commit/1f1243577cbdc206b6a0bfcde818411eb1b806ad))

##### Bug Fixes

-   [#&#8203;355](https://togithub.com/googleapis/java-datastore/issues/355) Explicitly passing --project argument when starting emulator ([#&#8203;923](https://togithub.com/googleapis/java-datastore/issues/923)) ([ef4065d](https://togithub.com/googleapis/java-datastore/commit/ef4065d233b968f58a34673aa53d39f60a013e2d))

##### Dependencies

-   Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.1.0 ([#&#8203;932](https://togithub.com/googleapis/java-datastore/issues/932)) ([1dbcea7](https://togithub.com/googleapis/java-datastore/commit/1dbcea73827961148800c1ec8e87065dbceb6c88))
-   Update dependency org.graalvm.buildtools:junit-platform-native to v0.9.18 ([#&#8203;924](https://togithub.com/googleapis/java-datastore/issues/924)) ([625e896](https://togithub.com/googleapis/java-datastore/commit/625e89685172ae546a813f5f7184223d01fbb0ac))
-   Update dependency org.graalvm.buildtools:junit-platform-native to v0.9.19 ([#&#8203;930](https://togithub.com/googleapis/java-datastore/issues/930)) ([77285be](https://togithub.com/googleapis/java-datastore/commit/77285be97fbd6bca1ada35202842238e306dd8dc))
-   Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.18 ([#&#8203;925](https://togithub.com/googleapis/java-datastore/issues/925)) ([0c7539d](https://togithub.com/googleapis/java-datastore/commit/0c7539d736ec993d7bb0531d7cd4dab1b08487a0))
-   Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.19 ([#&#8203;931](https://togithub.com/googleapis/java-datastore/issues/931)) ([40b4011](https://togithub.com/googleapis/java-datastore/commit/40b4011e3a826a91e33541efdecb05f0e129f87c))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-datastore).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4yNC4wIiwidXBkYXRlZEluVmVyIjoiMzQuMjQuMCJ9-->

* chore(main): release 2.13.1-SNAPSHOT (#934)

:robot: I have created a release *beep* *boop*
---


### Updating meta-information for bleeding-edge SNAPSHOT release.

---
This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).

* chore: Enable requesting numeric enums in "transport=rest" responses for services supporting this (Java, Go, Python, PHP, TypeScript, C#, and Ruby), even if they do not yet turn on REST transport (#933)

* chore: Enable requesting numeric enums in "transport=rest" responses for services supporting this (Java, Go, Python, PHP, TypeScript, C#, and Ruby), even if they do not yet turn on REST transport

chore: disallow "transport=rest" for services where numeric enums are not confirmed to be supported (except in PHP and Java)
PiperOrigin-RevId: 493113566

Source-Link: googleapis/googleapis@758f0d1

Source-Link: googleapis/googleapis-gen@78bd8f0
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNzhiZDhmMDVlMTI3NjM2M2ViMTRlYWU3MGU5MWZlNGJjMjA3MDNhYiJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>

* build(deps): bump certifi from 2022.9.24 to 2022.12.7 in /synthtool/gcp/templates/java_library/.kokoro (#1732) (#937)

build(deps): bump certifi

Bumps [certifi](https://togithub.com/certifi/python-certifi) from 2022.9.24 to 2022.12.7.
- [Release notes](https://togithub.com/certifi/python-certifi/releases)
- [Commits](https://togithub.com/certifi/python-certifi/compare/2022.09.24...2022.12.07)

---
updated-dependencies:
- dependency-name: certifi
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jeff Ching <chingor@google.com>
Source-Link: https://togithub.com/googleapis/synthtool/commit/ae0d43e5f17972981fe501ecf5a5d20055128bea
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-java:latest@sha256:9de537d592b60e5eac73b374a28263969bae91ecdb29b445e894576fbf54851c

* chore(deps): update dependency com.google.cloud:libraries-bom to v26.2.0 (#938)

* chore(deps): update dependency com.google.cloud:libraries-bom to v26.2.0

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: gcf-owl-bot[bot] <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Prateek <jainsahab@google.com>
Co-authored-by: Mend Renovate <bot@renovateapp.com>
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jeff Ching <chingor@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: datastore Issues related to the googleapis/java-datastore API. priority: p2 Moderately-important priority. Fix may not be included in next release. 🚨 This issue needs some love. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants