Streaming error Protobuf String field cannot be set null
book
Article ID: KB0073317
calendar_today
Updated On:
Description
There are no Typecheck errors shown in StreamBase Studio for this application which uses the Protobuf output adapter. At runtime we see this error repeatedly:
error description=Adapter Exception: Protobuf String field cannot be set null, originalTuple={"id":100,"phones":[], "address":{"zip":"","street":""}}, operatorName=default.Tuple2ProtobufWithDesc, inputPort=0, nodeName=sample_adapter_embedded_protobuf_protobuf.test, type=adapter-error, action=continue, time=2020-06-01 13:31:58.141-0400
Resolution
The Protobuf specification does not accept TIBCO Streaming EventFlow 'null' values since it does not have an equivalent representation. The tuple sent into the
Protobuf Output adapter must not have any fields (of any type) set to 'null'.
Specifically, the error "Protobuf String field cannot be set null" happens when the input to the Protobuf Output adapter has any string field that was missing, unset, or set explicitly to 'null'. This field will not be shown in the error message "originalTuple" field because this is a JSON string, and JSON also does not have a representation for 'null'.
If the input can contain missing/null values for some tuple fields, check the fields upstream with a
Map operator and replace the null with an empty string or non-null flag value. In a
Map expression this looks like (for string):
Replace, fieldA, if isnull(fieldA) then "" else fieldA Example:
Issue/Introduction
Protobuf does not support null values, so tuples with null fields are not allowed
Feedback
thumb_up
Yes
thumb_down
No