I'm currently trying to use google-cloud-firestore to access the contents of my Cloud Firestore. However, whenever I run .get on my DocumentReference, I get this error:
LoadError: cannot load such file -- grpc/grpc_c
from /Users/jurvistan/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
Sample Code:
> firestore = Google::Cloud::Firestore.new
> a = firestore.doc("foo/<hard-coded document uid>")
=> #<Google::Cloud::Firestore::DocumentReference:0x00007fe212bd4768
@client=#<Google::Cloud::Firestore::Client:0x00007fe212c3ec58 @service=Google::Cloud::Firestore::Service(...)>,
@path="projects/.../databases/(default)/documents/foo/...">
> a.get
Any idea what might be the problem here?
Hi @jurvis, can you please provide the library versions in your environment, most importantly the grpc version?
Also, your operating system and any other relevant details about your environment. Thanks!
The error you are seeing is most likely caused by: https://github.com/grpc/grpc/issues/25222
Here's a workaround for Ruby 3.0, grpc 1.36.0, and OS X:
% bundle update
Fetching gem metadata from https://rubygems.org/..........
Resolving dependencies...
...
Fetching grpc 1.36.0 (universal-darwin)
Installing grpc 1.36.0 (universal-darwin)
...
Bundle updated!
% gem install grpc --platform=ruby
Fetching grpc-1.36.0.gem
Building native extensions. This could take a while...
Successfully installed grpc-1.36.0
Parsing documentation for grpc-1.36.0
Installing ri documentation for grpc-1.36.0
Done installing documentation for grpc after 7 seconds
1 gem installed
% gem uninstall grpc
Select gem to uninstall:
1. grpc-1.36.0
2. grpc-1.36.0-universal-darwin
3. All versions
> 2
Successfully uninstalled grpc-1.36.0-universal-darwin
hi @quartzmo, thank you for responding so quickly!
I followed those steps you posted exactly but now get a different error:
[2] pry(main)> firestore.doc("foo/...").get
LoadError: cannot load such file -- /Users/jurvistan/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/grpc-1.36.0-universal-darwin/src/ruby/lib/grpc.rb
from /Users/jurvistan/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
Here's what I get when I run gem info --local grpc:
*** LOCAL GEMS ***
grpc (1.36.0)
Author: gRPC Authors
Homepage: https://github.com/google/grpc/tree/master/src/ruby
License: Apache-2.0
Installed at: /Users/jurvistan/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0
GRPC system in Ruby
System Information:
macOS 11.2.3, Ruby 3.0
I still see grpc-1.36.0-universal-darwin in your new backtrace. There's some staleness there but I'm not sure why.
The output from gem info --local grpc looks ok to me, but for some reason your runtime (pry, bootsnap) is looking for grpc-1.36.0-universal-darwin.
Anyway, the workaround above is probably not a great solution for anyone. If you use Bundler, it keeps re-installing grpc-1.36.0-universal-darwin.
Here's the grpc PR that promises to fix the error:
I managed to get the workaround to work!
It's a bit silly, but after you mentioned staleness in my pry runtime, I remembered I had forgotten to reload my Rails console. thank you!
This was fixed in grpc v1.37.0! 馃帀
Ruby
- Cherry-pick PR #25429 "Add ruby 3.0 support for mac binary packages" to 1.37.x. (#25869)