# Value not wanting to be serialised into protobuf

**URL:** <https://forum.confluent.io/t/value-not-wanting-to-be-serialised-into-protobuf/10907>\
**Category:** Non-Java Clients\
**Created:** [16 June 2024 14:03 UTC](https://forum.confluent.io/t/value-not-wanting-to-be-serialised-into-protobuf/10907 "2024-06-16T14:03:13Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![georgelza](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/georgelza/32/3026_2.png) [@georgelza](https://forum.confluent.io/u/georgelza)\
**Post date:** [16 June 2024 14:03 UTC](https://forum.confluent.io/t/value-not-wanting-to-be-serialised-into-protobuf/10907/1 "2024-06-16T14:03:14Z")

</div>

Hi all…

Need someone that has worked with protobuf, schema registry and Kafka using the confluent library stack.

For the following git repo, cmd/producer.go

> **[GitHub - georgelza/MongoCreator-GoProducer: Mongo Community Creator GoLang...](https://github.com/georgelza/MongoCreator-GoProducer)**
>
> Mongo Community Creator GoLang Basket Producer. Contribute to georgelza/MongoCreator-GoProducer development by creating an account on GitHub.

I serialise the payload as per a couple of examples (Line 974), but getting the following message on the serialise step.

`Failed to serialize record: serialization target must be a protobuf message. Got`

please help

G

---

<div class="post-metadata">

**Author:** ![dtroiano](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/dtroiano/32/1961_2.png) [@dtroiano](https://forum.confluent.io/u/dtroiano)\
**Post date:** [17 June 2024 13:54 UTC](https://forum.confluent.io/t/value-not-wanting-to-be-serialised-into-protobuf/10907/2 "2024-06-17T13:54:47Z")

</div>

Try passing `&pb_Basket` (the message should be a pointer, see [here](https://pkg.go.dev/github.com/confluentinc/confluent-kafka-go/v2/schemaregistry/serde#Serializer)).

---

<div class="post-metadata">

**Author:** ![georgelza](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/georgelza/32/3026_2.png) [@georgelza](https://forum.confluent.io/u/georgelza)\
**Post date:** [17 June 2024 16:38 UTC](https://forum.confluent.io/t/value-not-wanting-to-be-serialised-into-protobuf/10907/3 "2024-06-17T16:38:14Z")

</div>

Well some how it missed that &, tried one everywhere else…  
dev made a difference… changed the error 😉

```auto
2024/06/17 18:35:43 Basket: Failed to serialize record: Post "localhost:///subjects/pb_salesbaskets-value/versions?normalize=false": unsupported protocol scheme "localhost"
exit status 1

```

I pass schema registry as _localhost:8081_ via the variable _vKafka.SchemaRegistryURL_

`client, err = schemaregistry.NewClient(schemaregistry.NewConfig(vKafka.SchemaRegistryURL))`

---

<div class="post-metadata">

**Author:** ![georgelza](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/georgelza/32/3026_2.png) [@georgelza](https://forum.confluent.io/u/georgelza)\
**Post date:** [17 June 2024 16:43 UTC](https://forum.confluent.io/t/value-not-wanting-to-be-serialised-into-protobuf/10907/4 "2024-06-17T16:43:49Z")

</div>

interesting… changed my schema registry url to include http:// as [http://localhost:8081](http://localhost:8081)

changed error to

```auto
2024/06/17 18:41:31 INFO: Post to Confluent Kafka topics
2024/06/17 18:41:31 Payment: Failed to serialize record: schema registry request failed error code: 409: Schema being registered is incompatible with an earlier schema for subject "pb_salespayments-value", details: [{errorType:"MESSAGE_REMOVED", description:"The new schema is missing a MESSAGE type at path '#/pb_Payment' in the old schema"}, {oldSchemaVersion: 1}, {oldSchema: 'syntax = "proto3";
package types;

message pb_Payment {
  string InvoiceNumber = 1;
  string PayDateTime = 2;
  string PayTimestamp = 3;
  double Paid = 4;
  string FinTransactionID = 5;
}
'}, {validateFields: 'false', compatibility: 'BACKWARD'}]
exit status 1
g-mbp.local:/Users/george/Desktop/MongoCreater/goProd 0.4 -not working >

```

---

<div class="post-metadata">

**Author:** ![georgelza](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/georgelza/32/3026_2.png) [@georgelza](https://forum.confluent.io/u/georgelza)\
**Post date:** [17 June 2024 16:46 UTC](https://forum.confluent.io/t/value-not-wanting-to-be-serialised-into-protobuf/10907/5 "2024-06-17T16:46:26Z")

</div>

guess this is cheating. deleted the previous schema registry entries and reran…  
well i got a payloads on my topics, even if they look very json like…  
🙂  
G

---

<div class="post-metadata">

**Author:** ![georgelza](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/georgelza/32/3026_2.png) [@georgelza](https://forum.confluent.io/u/georgelza)\
**Post date:** [17 June 2024 17:06 UTC](https://forum.confluent.io/t/value-not-wanting-to-be-serialised-into-protobuf/10907/6 "2024-06-17T17:06:29Z")

</div>

Now to see if i can get my streams processing (create stream) rebuild, with the topics now based on protobuf…  
G

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/confluentcommunity/original/1X/c49438c90c9df282e9996fdf6971be890c71b65a.svg) [@system](https://forum.confluent.io/u/system)\
**Post date:** [24 June 2024 17:06 UTC](https://forum.confluent.io/t/value-not-wanting-to-be-serialised-into-protobuf/10907/7 "2024-06-24T17:06:46Z")

</div>

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