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

testing: test with Ruby 2.6 #390

Closed
tbpg opened this issue Jan 17, 2019 · 5 comments
Closed

testing: test with Ruby 2.6 #390

tbpg opened this issue Jan 17, 2019 · 5 comments
Assignees
Labels
samples Issues that are directly related to samples. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@tbpg
Copy link
Contributor

tbpg commented Jan 17, 2019

No description provided.

@tbpg tbpg self-assigned this Jan 17, 2019
@tbpg
Copy link
Contributor Author

tbpg commented Jan 17, 2019

cc @TheRoyalTnetennba

@mattwelke
Copy link

mattwelke commented Feb 3, 2019

@tbpg I think the firestore gem doesn't work with Ruby 2.6 right now.

I followed the instructions for the "add-data" how-to guide on the website (https://cloud.google.com/firestore/docs/manage-data/add-data), meaning creating a new directory with a new Gemfile which contained the following:

source 'https://rubygems.org'

gem 'google-cloud-firestore'

I made an app.rb file which contained the following:

require "google/cloud/firestore"

GCP_PROJECT_ID = 'REDACTED'

firestore = Google::Cloud::Firestore.new project_id: GCP_PROJECT_ID

puts "Created Cloud Firestore client with project ID #{GCP_PROJECT_ID} ."

doc_ref = firestore.doc "users/alovelace"

doc_ref.set({
  first: "Ada",
  last:  "Lovelace",
  born:  1815
})

puts "Added data to the alovelace document in the users collection."

I also used export GOOGLE_APPLICATION_CREDENTIALS="path_to_file" to set the service account file before attempting to run the program.

But, when I run bundle install and then bundle exec ruby app.rb, I get the following error:

Traceback (most recent call last):
        23: from app.rb:1:in `<main>'
        22: from app.rb:1:in `require'
        21: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/google-cloud-firestore-0.24.2/lib/google/cloud/firestore.rb:17:in `<top (required)>'
        20: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/google-cloud-firestore-0.24.2/lib/google/cloud/firestore.rb:17:in `require'
        19: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/google-cloud-firestore-0.24.2/lib/google/cloud/firestore/client.rb:16:in `<top (required)>'
        18: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/google-cloud-firestore-0.24.2/lib/google/cloud/firestore/client.rb:16:in `require'
        17: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/google-cloud-firestore-0.24.2/lib/google/cloud/firestore/v1beta1.rb:16:in `<top (required)>'
        16: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/google-cloud-firestore-0.24.2/lib/google/cloud/firestore/v1beta1.rb:16:in `require'
        15: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/google-cloud-firestore-0.24.2/lib/google/cloud/firestore/v1beta1/firestore_client.rb:26:in `<top (required)>'
        14: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/google-cloud-firestore-0.24.2/lib/google/cloud/firestore/v1beta1/firestore_client.rb:26:in `require'
        13: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/google-gax-1.5.0/lib/google/gax.rb:30:in `<top (required)>'
        12: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/google-gax-1.5.0/lib/google/gax.rb:30:in `require'
        11: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/google-gax-1.5.0/lib/google/gax/api_callable.rb:32:in `<top (required)>'
        10: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/google-gax-1.5.0/lib/google/gax/api_callable.rb:32:in `require'
         9: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/google-gax-1.5.0/lib/google/gax/errors.rb:32:in `<top (required)>'
         8: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/google-gax-1.5.0/lib/google/gax/errors.rb:32:in `require'
         7: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/google-gax-1.5.0/lib/google/gax/grpc.rb:31:in `<top (required)>'
         6: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/google-gax-1.5.0/lib/google/gax/grpc.rb:31:in `require'
         5: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/grpc-1.18.0-x86_64-linux/src/ruby/lib/grpc/google_rpc_status_utils.rb:16:in `<top (required)>'
         4: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/grpc-1.18.0-x86_64-linux/src/ruby/lib/grpc/google_rpc_status_utils.rb:16:in `require'
         3: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/googleapis-common-protos-types-1.0.2/lib/google/rpc/status_pb.rb:4:in `<top (required)>'
         2: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/googleapis-common-protos-types-1.0.2/lib/google/rpc/status_pb.rb:4:in `require'
         1: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/google-protobuf-3.6.1-x86_64-linux/lib/google/protobuf.rb:48:in `<top (required)>'
/home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/google-protobuf-3.6.1-x86_64-linux/lib/google/protobuf.rb:48:in `require': cannot load such file -- google/2.6/protobuf_c (LoadError)
        24: from app.rb:1:in `<main>'
        23: from app.rb:1:in `require'
        22: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/google-cloud-firestore-0.24.2/lib/google/cloud/firestore.rb:17:in `<top (required)>'
        21: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/google-cloud-firestore-0.24.2/lib/google/cloud/firestore.rb:17:in `require'
        20: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/google-cloud-firestore-0.24.2/lib/google/cloud/firestore/client.rb:16:in `<top (required)>'
        19: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/google-cloud-firestore-0.24.2/lib/google/cloud/firestore/client.rb:16:in `require'
        18: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/google-cloud-firestore-0.24.2/lib/google/cloud/firestore/v1beta1.rb:16:in `<top (required)>'
        17: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/google-cloud-firestore-0.24.2/lib/google/cloud/firestore/v1beta1.rb:16:in `require'
        16: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/google-cloud-firestore-0.24.2/lib/google/cloud/firestore/v1beta1/firestore_client.rb:26:in `<top (required)>'
        15: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/google-cloud-firestore-0.24.2/lib/google/cloud/firestore/v1beta1/firestore_client.rb:26:in `require'
        14: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/google-gax-1.5.0/lib/google/gax.rb:30:in `<top (required)>'
        13: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/google-gax-1.5.0/lib/google/gax.rb:30:in `require'
        12: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/google-gax-1.5.0/lib/google/gax/api_callable.rb:32:in `<top (required)>'
        11: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/google-gax-1.5.0/lib/google/gax/api_callable.rb:32:in `require'
        10: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/google-gax-1.5.0/lib/google/gax/errors.rb:32:in `<top (required)>'
         9: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/google-gax-1.5.0/lib/google/gax/errors.rb:32:in `require'
         8: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/google-gax-1.5.0/lib/google/gax/grpc.rb:31:in `<top (required)>'
         7: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/google-gax-1.5.0/lib/google/gax/grpc.rb:31:in `require'
         6: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/grpc-1.18.0-x86_64-linux/src/ruby/lib/grpc/google_rpc_status_utils.rb:16:in `<top (required)>'
         5: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/grpc-1.18.0-x86_64-linux/src/ruby/lib/grpc/google_rpc_status_utils.rb:16:in `require'
         4: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/googleapis-common-protos-types-1.0.2/lib/google/rpc/status_pb.rb:4:in `<top (required)>'
         3: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/googleapis-common-protos-types-1.0.2/lib/google/rpc/status_pb.rb:4:in `require'
         2: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/google-protobuf-3.6.1-x86_64-linux/lib/google/protobuf.rb:47:in `<top (required)>'
         1: from /home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/google-protobuf-3.6.1-x86_64-linux/lib/google/protobuf.rb:50:in `rescue in <top (required)>'
/home/matt/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/google-protobuf-3.6.1-x86_64-linux/lib/google/protobuf.rb:50:in `require': cannot load such file -- google/protobuf_c (LoadError)

I tried cloning this samples repo and grabbing its Gemfile.lock, copying it into my test directory, installing its particular version of bundler (1.17.3), switching to Ruby 2.5.0 with rbenv, running bundle install and then running my program again with bundle exec ruby app.rb, and this time it works:

Created Cloud Firestore client with project ID REDACTED .
Added data to the alovelace document in the users collection.

I don't have a ton of Ruby experience, so I don't know exactly what's wrong, but to me the stack trace makes it look like there's an issue with how the latest version of the google-cloud-firestore gem is wired up to its dependency gems. It might have to do with the "proto_c" in the stack trace.

@tbpg
Copy link
Contributor Author

tbpg commented Feb 4, 2019

Thank you for trying this out, @Welkie. But, this is blocked on googleapis/google-cloud-ruby#2825. Sorry I forgot to update this bug.

@mattwelke
Copy link

@tbpg Thanks for following up with me. I should have posted back that I found that issue while digging further. I was able to follow its workaround to get it running on 2.6.0 (setting platform to ruby) but I found those steps complicated and error prone. I'll wait for official 2.6 support. 👍

@JustinBeckwith JustinBeckwith added triage me I really want to be triaged. 🚨 This issue needs some love. labels Oct 3, 2019
@TheRoyalTnetennba TheRoyalTnetennba added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. and removed 🚨 This issue needs some love. triage me I really want to be triaged. labels Oct 9, 2019
@product-auto-label product-auto-label bot added the samples Issues that are directly related to samples. label Aug 28, 2020
@fhinkel fhinkel assigned fhinkel and unassigned TheRoyalTnetennba and tbpg Dec 8, 2020
@fhinkel
Copy link

fhinkel commented Dec 8, 2020

Greetings, we're closing this. Looks like the issue got resolved. Please let us know if the issue needs to be reopened.

@fhinkel fhinkel closed this as completed Dec 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
samples Issues that are directly related to samples. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

5 participants