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

[Bug] CloudEvents variable names do not support underscores #4623

Closed
3 tasks done
mxsm opened this issue Dec 7, 2023 · 0 comments · Fixed by #4624
Closed
3 tasks done

[Bug] CloudEvents variable names do not support underscores #4623

mxsm opened this issue Dec 7, 2023 · 0 comments · Fixed by #4624
Labels
bug Something isn't working

Comments

@mxsm
Copy link
Member

mxsm commented Dec 7, 2023

Search before asking

  • I had searched in the issues and found no similar issues.

Environment

Windows

EventMesh version

master

What happened

CloudEvents variable names do not support underscores。

How to reproduce

    public static void main(String[] args) {
        CloudEvent.Builder builder = CloudEvent.newBuilder().setId(RandomStringUtils.generateUUID()).setSpecVersion("1.0")
            .putAttributes(ProtocolKey.GRPC_RESPONSE_CODE, CloudEventAttributeValue.newBuilder().setCeString("").build())
            .putAttributes(ProtocolKey.GRPC_RESPONSE_MESSAGE,
                CloudEventAttributeValue.newBuilder().setCeString("").build())
            .putAttributes(ProtocolKey.GRPC_RESPONSE_TIME, CloudEventAttributeValue.newBuilder()
                .setCeTimestamp(Timestamp.newBuilder().setSeconds(1).build()).build());
        final io.cloudevents.CloudEvent cloudEvent = switchEventMeshCloudEvent2CloudEvent(builder.build());
    }

Debug logs

Exception in thread "main" io.cloudevents.rw.CloudEventRWException: Invalid extensions name: status_code
at io.cloudevents.rw.CloudEventRWException.newInvalidExtensionName(CloudEventRWException.java:122)
at io.cloudevents.core.impl.BaseCloudEventBuilder.withExtension(BaseCloudEventBuilder.java:121)
at io.cloudevents.core.v1.CloudEventBuilder.withContextAttribute(CloudEventBuilder.java:176)
at io.cloudevents.protobuf.ProtoDeserializer.read(ProtoDeserializer.java:73)
at io.cloudevents.rw.CloudEventReader.read(CloudEventReader.java:43)
at io.cloudevents.protobuf.ProtobufFormat.deserialize(ProtobufFormat.java:64)
at io.cloudevents.core.format.EventFormat.deserialize(EventFormat.java:56)
at org.apache.eventmesh.client.grpc.util.EventMeshCloudEventBuilder.switchEventMeshCloudEvent2CloudEvent(EventMeshCloudEventBuilder.java:272)
at org.apache.eventmesh.client.grpc.util.EventMeshCloudEventBuilder.main(EventMeshCloudEventBuilder.java:294)

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
1 participant