logstash-plugins / logstash-codec-protobuf

Codec plugin for parsing Protobuf messages
Apache License 2.0
26 stars 16 forks source link

Undefined method add_file add_file - protobuf 3 #41

Closed pelalartategui closed 5 years ago

pelalartategui commented 5 years ago

I use protobuf 3, compiled with official google compiler as codec in Kakfa input. Logstash version: 6.7.1 plugin version: 1.1.0

ERROR:

Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:main, :exception=>"NoMethodError", :message=>"undefined method add_file' for #<Google::Protobuf::Builder:0x29a7906f>", :backtrace=>["/usr/share/logstash/proto/table_pb.rb:7:in block in <main>'"

Kakfa input:

 input { 
  kafka {
    bootstrap_servers  => {{ kafka_instances | to_json }}
    topics => {{ kafka_topics | to_json }}
    key_deserializer_class => "org.apache.kafka.common.serialization.ByteArrayDeserializer"
    value_deserializer_class => "org.apache.kafka.common.serialization.ByteArrayDeserializer"
    codec => protobuf
     {
       class_name => {{ class_name }}
       include_path => ['/usr/share/logstash/proto/table_pb.rb', '/usr/share/logstash/proto/xs_pb.rb']
       protobuf_version => 3

     }
  }
}

Thank you a lot.

IngaFeick commented 5 years ago

Hi! This error is caused by an incompatibility between your protoc version (probably 3.7?) and the rather old jruby implementation that is shipped with this codec. The problem is that the jruby version is not well maintained and we cannot easily update it ourselves. We're looking into this though. In the meantime you can workaround this by using the 3.5.0 version of protoc.

pelalartategui commented 5 years ago

Thank you!

jthack commented 4 years ago

Any traction on this @IngaFeick (ie a better fix than just "use an old version")

IngaFeick commented 4 years ago

@jthack we depend on the last released version of the jruby protobuf gem, which is not part of our project. There is nothing we can do about this. You might want to voice your interest here: https://github.com/protocolbuffers/protobuf/issues/1594

treykasada commented 2 years ago

Just hit this error as well. Unfortunately, using protoc 3.5.0 isn't an option in our case as our Protobuf definitions make use of proto3's new optional keyword, and support for that was only added in protoc 3.15.0.

@IngaFeick It looks like protocolbuffers/protobuf#1594 was recently closed. Does that mean a fix for this is now feasible?

gr790 commented 1 year ago

I tried to use google-protobuf 3.5.0 pre version also, but still same error, working on fix it...