Skip to content
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

Nested Protobuf Message with oneof fails to convert #347

Open
metropolis-ameer opened this issue Jun 4, 2024 · 0 comments · May be fixed by #348
Open

Nested Protobuf Message with oneof fails to convert #347

metropolis-ameer opened this issue Jun 4, 2024 · 0 comments · May be fixed by #348

Comments

@metropolis-ameer
Copy link

metropolis-ameer commented Jun 4, 2024

Example proto

message SourceMetadata {
  string source_id = 1;
  oneof source {
    string registered = 2;
    string unregistered = 3;
  }
}

message Eventr {
  SourceMetadata source_meta = 1;
  event_id = 2;
}

Producing and consuming records serialized by this proto in an application works fine.
Consuming an Eventr record serialized by this proto with an MSK connect connector fails to create the connect schema from the proto correctly. For the record below, the error would show

<html><head></head><body>
[Worker-0504c2846446741d1] Caused by: org.apache.kafka.connect.errors.DataException: Error converting value: "source_id: "TEST1717029245841207579"
[Worker-0504c2846446741d1] registered: user123
[Worker-0504c2846446741d1] " (Java Type: class com.google.protobuf.DynamicMessage, Protobuf type: MESSAGE) to Connect type: STRUCT
[Worker-0504c2846446741d1] 	at com.amazonaws.services.schemaregistry.kafkaconnect.protobuf.toconnectdata.ProtobufDataToConnectDataConverter.toConnectDataField(ProtobufDataToConnectDataConverter.java:101)
[Worker-0504c2846446741d1] 	at com.amazonaws.services.schemaregistry.kafkaconnect.protobuf.toconnectdata.ProtobufDataToConnectDataConverter.toConnectData(ProtobufDataToConnectDataConverter.java:67)
[Worker-0504c2846446741d1] 	at com.amazonaws.services.schemaregistry.kafkaconnect.protobuf.ProtobufSchemaConverter.toConnectData(ProtobufSchemaConverter.java:122)
[Worker-0504c2846446741d1] 	at org.apache.kafka.connect.storage.Converter.toConnectData(Converter.java:87)
[Worker-0504c2846446741d1] 	at org.apache.kafka.connect.runtime.WorkerSinkTask.convertValue(WorkerSinkTask.java:545)
[Worker-0504c2846446741d1] 	at org.apache.kafka.connect.runtime.WorkerSinkTask.lambda$convertAndTransformRecord$1(WorkerSinkTask.java:501)
[Worker-0504c2846446741d1] 	at org.apache.kafka.connect.runtime.errors.RetryWithToleranceOperator.execAndRetry(RetryWithToleranceOperator.java:156)
[Worker-0504c2846446741d1] 	at org.apache.kafka.connect.runtime.errors.RetryWithToleranceOperator.execAndHandleError(RetryWithToleranceOperator.java:190)
[Worker-0504c2846446741d1] 	... 13 more
[Worker-0504c2846446741d1] Caused by: org.apache.kafka.connect.errors.DataException: Invalid value: null used for required field: "unregistered", schema type: STRING
[Worker-0504c2846446741d1] 	at org.apache.kafka.connect.data.ConnectSchema.validateValue(ConnectSchema.java:220)
[Worker-0504c2846446741d1] 	at org.apache.kafka.connect.data.Struct.validate(Struct.java:233)
[Worker-0504c2846446741d1] 	at org.apache.kafka.connect.data.ConnectSchema.validateValue(ConnectSchema.java:253)
[Worker-0504c2846446741d1] 	at org.apache.kafka.connect.data.Struct.put(Struct.java:216)
{
source_meta = {
  source_id = "TEST1717029245841207579"
  registered = "user123"
}
event_id = "123-213-321dj"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant