Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

argo events cannot be Unmarshaled #1081

Open
caibirdme opened this issue Jul 18, 2024 · 2 comments
Open

argo events cannot be Unmarshaled #1081

caibirdme opened this issue Jul 18, 2024 · 2 comments

Comments

@caibirdme
Copy link

caibirdme commented Jul 18, 2024

Here's argo events' data

    {
        "context": {
          "type": "type_of_event_source",
          "specversion": "cloud_events_version",
          "source": "name_of_the_event_source",
          "id": "unique_event_id",
          "time": "event_time",
          "datacontenttype": "type_of_data",
          "subject": "name_of_the_configuration_within_event_source"
        },
        "data": {
          "header": {},
          "body": {},
        }
    }

But when I run

ev := cloudevents.NewEvent()
err := json.Unmarshal(data, &ev)

it reports error. It seems that attributes shouldn't be wrapped into context key?

And here's argo events' doc: https://argoproj.github.io/argo-events/tutorials/02-parameterization/#webhook-event-payload

@embano1
Copy link
Member

embano1 commented Jul 18, 2024

@caibirdme this is not a CloudEvent, so won't parse. What is the goal you're trying to achieve? Or is this rather a question that should be asked in the Argo repository?

@caibirdme
Copy link
Author

argo-event can convert http request to cloudevent format, which I think could simply use this package to Unmarshal. But it seems like argo's cloudevent is not standard cloudevent...

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants