Breaking changes in google-protobuf 4+
The release of google-protobuf 4 cause pg_query to throw exceptions when the older Ruby DSL methods are used. For instance:
NoMethodError: undefined method `build' for #<Google::Protobuf::DescriptorPool:0x000000010ceb94b8> (NoMethodError)
Google::Protobuf::DescriptorPool.generated_pool.build do
^^^^^^
~/.bundles/securicy-app/ruby/3.2.0/gems/pg_query-2.2.1/lib/pg_query/pg_query_pb.rb:6:in `<top (required)>'
The change in google-protobuf is here: https://github.com/protocolbuffers/protobuf/commit/5cfc9e775d76acb37e5b554e53dff336a89d000f
Announcement of the breaking changes is the: https://protobuf.dev/news/2023-04-20/
I've hit this too.. any updates on a fix?
Hit this today trying to go to Ruby 3.3. Any ETA on Fix?
We haven't triaged this in detail yet - for now the recommendation would be to pin google-protobuf to an older version until we've made the necessary changes.
For those running into this, is there a requirement to move to the newer google-protobuf?
Hey @dark-panda Can you make me remember, how I can reproduce this error?
Because, I do remember, I saw exact the same trace, but can not reproduce it anymore on my app with Rails
7.0.8.1 and Ruby 3.3.
I am working an upgrade from Dependabot, where I had before:
gem "google-protobuf", "~> 3.25", ">= 3.25.3"
And now:
gem "google-protobuf", "~> 4.26
And everything works 💯.
Also, the gem prosopite, which depends on pg_query, works as expected.
It seems this was likely resolved in the 5.0 release, since the .build method call no longer appears in pg_query_pb.rb. Thus closing this issue, but please let us know if this is still a problem.