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
Can't get default credentials for use with datastore emulator #610
Comments
Hi @SamKelly, I ran into this running locally with gcd.sh. It worked when I was already authenticated with gcloud but I wanted my devel and test environments to not have an external dependency. I am not sure if the gcloud beta emulators datastore uses gcd but based on your error message I think this might work for you as well. I created a file in lib named 'local_datastore_no_auth:
I create my datastore dataset in an initializer like this:
|
This is even better! Thanks! |
/cc @quartzmo Any chance we can automate this? It makes me sad to see the overrides and all that... |
@bmclean Thanks for sharing this solution! @jgeewax In my opinion, we should definitely support insecure access. (This is similar to #491.) As we transition to gRPC, the implementation details will almost certainly change, so am I right to assume that our upcoming Datastore |
yep, v1beta3 is the right target IMO
|
Possible duplication with #604? |
@quartzmo I am using the updated emulator AFAIK |
@SamKelly Thanks. We will definitely test/develop against the updated emulator. |
@quartzmo would also be great if the documentation specifically talks about there even being an emulator and how to connect to it from ruby -- was sort of buried e.g. http://googlecloudplatform.github.io/gcloud-ruby/docs/master/Gcloud/Datastore.html makes no mention of what to do in "development" or "testing" mode... |
is |
@SamKelly Do you want to open a new issue for the docs? I strongly agree that using the emulator should be covered. Regarding the emulator update, I don't know of any other way to do it, or how to verify the version. Please post here if you find anything helpful. |
@quartzmo I posted feedback on the docs when I was on the page (I think?) but not sure how else to do it -- if you want to open something please by all means 👍 |
@bmclean actually this does not seem to be working for me. While I no longer get the error message when I try to connect, I always get the following message when I try to save a record:
|
I'm sort of in a hurry with this does anyone know what I can do to get gcloud_ruby to use the datastore emulator? I must be missing something but nothing from above has helped beyond suppressing the missing keyfile error message. What is the proper way to connect? I don't understand why a monkey patch should be necessary in the first place. Please help |
Hi @SamKelly,
Try this in a Rails initializer file (make sure to restart the rails server to pick up the change):
When I change to an incorrect port I receive the Gcloud::Datastore::ApiError error message. |
OK I'll try that -- what is the gcd tool? People keep mentioning this and I"m not sure what it is. |
It is the google cloud datastore (gcd) emulator. If you run
and start it like this:
Now it looks like I can just do it like this:
and
|
ok thanks -- manually fixing the port will definitely make things less complicated for me as well |
So turns out my issue was in my project id -- in ruby I was using an underscore in the name, but in my emulator config I was using a dash... /facepalm |
Is there a way we could've made the error message more clear ? Or was it If it's the former, I'd love to try to clarify the error message you got so On Wed, Apr 6, 2016 at 12:25 AM, Sam Kelly notifications@github.com wrote:
|
@jgeewax As we transition to gRPC, the implementation details will almost certainly change, so we have a fresh chance to ensure that our emulator support handles error conditions clearly, in order to minimize user frustration while attempting to connect to the emulator. Also, updates to our emulator support should permit insecure access, thus preventing the need for the customization that @bmclean helpfully provided. I noted both of these issues in #604. @SamKelly If you feel #604 will resolve everything covered in this issue going forward, please close this issue. However, if for some reason you believe you will be unable to upgrade to the next version of gcloud-ruby (using gRPC to connect to Datastore v1beta3, see #314), let us know here. |
@quartzmo @jgeewax As long as the gRPC implementation has better awareness of when it is using the emulator vs when it is using a production datastore, I think everything should be fine. Maybe when there is a datastore error, gcloud_ruby should suggest looking at the emulator log -- this would have saved me some time, even though it was a bit of a facepalm. |
@SamKelly We really appreciate your help as together we work out the kinks in using gcloud-ruby for Datastore development. Please do not hesitate to open issues such as this one when you run into something that you think could be better. Obviously we don't have control over everything (just this layer), but we do have control over our documentation and by adding your hard-earned knowledge there, I think we can do much to improve the user experience. |
@quartzmo no problem -- I'm just glad you guys have been so responsive! |
I am trying to use the datastore emulator locally with my rails app in development mode for testing etc.
I run the beta datastore emulator, then run
gcloud beta emulators datastore env-init
and make sure those environment variables are in my .bashrc file (and source my .bashrc file). Then I try to do the following from within Rails:I get the following error:
I was under the impression I did not need a keyfile if using the datastore emulator. If I do need a keyfile, how do I create it? The datastore emulator documentation doesn't mention this at all, and seems to suggest that merely having these environment variables in place should be enough for local clients to connect automatically.
Please advise!
The text was updated successfully, but these errors were encountered: