-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ProtobufSerializer Error: message type name is empty #217
Comments
@baumac , are you using Schema Registry from CP? If so, which version? |
@baumac, for Protobuf, this library needs changes from confluentinc/schema-registry#3276, which will be in the next CP patch releases. |
@rayokota that's great news, is there a ticket or GH issue we can be tracking to know when the Protobuf Serde tooling will be working in the |
I'm having the same issue, but I'm using Confluent Cloud so I'm not really certain what version of Schema Registry it's using. Assuming the above-referenced changes are even available there, there are also changes that need to be made here, correct? I would be interested in contributing to fix this since the other JS client is completely broken in this regard and this at least seems more cohesive and close to being complete, and this functionality is crucial to me. |
Ok, I'll try to look into this again when I get a chance |
Sorry I misunderstand the issue earlier. It still holds true that this needs changes from confluentinc/schema-registry#3276. (These changes are in Confluent Cloud.). Otherwise the example will work with the following: Types need to be registered directly in the registry as shown here, as follows:
So the following works (note the
|
EDIT: Instead of manually setting import { create } from '@bufbuild/protobuf';
import { TestSchema } from './gen/Test_pb';
// Sets up the client and serializer/registry
const client = new SchemaRegistryClient();
const serializer = new ProtobufSerializer(schemaRegistryClient, SerdeType.VALUE, {
useLatestVersion: true,
});
serializer.registry.add(TestSchema);
// Serializes a message
const rawMessage = {
meta: {
foo: 'foo',
},
bar: 42,
};
const message = create(TestSchema, rawMessage);
const buf = serializer.serialize('test_topic', message); // Properly encoded IMO this step of calling ORIGINAL: Thank you very much for the guidance. With your help and some digging, I was able to piece it together and get everything working. Some notes for those perhaps coming behind me (please correct me if I'm wrong):
One last thing I found through a ton of digging:
And in another schema:
The serialized object must look like this, noting the additional {
"$typeName": "test.Test",
"meta": {
"$typeName": "test.Meta",
"foo": "test"
},
"bar": 42
} If you don't, a |
Description
When attempting to serialize messages using the
ProtobufSerializer
an error is always thrown.Environment Information
Steps to Reproduce
Execute the below code and it will throw the following error:
Code to reproduce: a test example has been created in #218 (comment)
Additional context
When trying to serialize a message using the ProtoSerializer an error is thrown. The expected behavior is that the serialize should be able to successfully serialize messages.
Note: If the above code is changed to include the
$typeName
then the error changes to the following:Code to reproduce:
The text was updated successfully, but these errors were encountered: