diff --git a/pubsub/envelope.go b/pubsub/envelope.go index 4a4d048af..d57a8793c 100644 --- a/pubsub/envelope.go +++ b/pubsub/envelope.go @@ -103,6 +103,19 @@ func FromCloudEvent(cloudEvent []byte, topic, pubsub, traceID string) (map[strin m[TopicField] = topic m[PubsubField] = pubsub + // specify default value if it's unspecified from the original CloudEvent + if m[SourceField] == nil { + m[SourceField] = DefaultCloudEventSource + } + + if m[TypeField] == nil { + m[TypeField] = DefaultCloudEventType + } + + if m[SpecVersionField] == nil { + m[SpecVersionField] = CloudEventsSpecVersion + } + return m, nil }