# Protobuf data decode issue

**URL:** <https://discuss.elastic.co/t/protobuf-data-decode-issue/330976>\
**Category:** Logstash\
**Created:** [April 27, 2023, 3:21pm UTC](https://discuss.elastic.co/t/protobuf-data-decode-issue/330976 "2023-04-27T15:21:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nithingowda](https://avatars.discourse-cdn.com/v4/letter/n/e274bd/32.png) [@Nithingowda](https://discuss.elastic.co/u/Nithingowda)\
**Post date:** [April 27, 2023, 3:21pm UTC](https://discuss.elastic.co/t/protobuf-data-decode-issue/330976/1 "2023-04-27T15:21:12Z")

</div>

Here is the code to read the protobuf data from pubsub and decode in logstash but we are unable to decode the protobuf data.

Code:

```auto
  input {
   google_pubsub {
        project_id => "project_id"
        topic => "topic_name"
        subscription => "subscription_name"
        json_key_file => "/etc/logstash/project_name/key.json"
        create_subscription => false
        codec => protobuf
        {
          class_name => "class_name"
          class_file => ['class_name_pb.rb']
          protobuf_root_directory => "/etc/logstash/project_name/protobuf/"
          protobuf_version => 3
        }
    }
}
output { stdout { codec => rubydebug } }

```

ERROR Message:  
[ERROR] 2023-04-05 10:58:16.518 [Converge PipelineAction::Create] protobuf - Unable to load file: /etc/logstash/project\_name/protobuf/class\_name\_pb.rb. Reason: #\<NoMethodError: undefined method `add_file' for #<Google::Protobuf::Builder:0x54501fc9>> [ERROR] 2023-04-05 10:58:16.521 [Converge PipelineAction::Create<main>] agent - Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:main, :exception=>"Java::JavaLang::IllegalStateException", :message=>"Unable to configure plugins: (NoMethodError) undefined method `add\_file' for #Google::Protobuf::Builder:0x54501fc9", :

Above I used 3.20.0 protoc version

I have referred few google comments and they suggested to use protoc 3.5.0 Version. But when I used protoc 3.5.0 Version I did not get any error but Logstash code was not reading any data.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 25, 2023, 3:21pm UTC](https://discuss.elastic.co/t/protobuf-data-decode-issue/330976/2 "2023-05-25T15:21:40Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
