pg_query icon indicating copy to clipboard operation
pg_query copied to clipboard

Breaking changes in google-protobuf 4+

Open dark-panda opened this issue 1 year ago • 4 comments

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/

dark-panda avatar Mar 18 '24 14:03 dark-panda

I've hit this too.. any updates on a fix?

wflanagan avatar Mar 28 '24 16:03 wflanagan

Hit this today trying to go to Ruby 3.3. Any ETA on Fix?

mcg avatar Apr 29 '24 19:04 mcg

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?

lfittl avatar Apr 29 '24 21:04 lfittl

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.

viktorianer avatar Jun 03 '24 20:06 viktorianer

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.

lfittl avatar Jan 16 '25 00:01 lfittl