Skip to content

Error while using SSERequestID with ServerSentEvents #3753

@maxott

Description

@maxott

I have been following the example in the tutorial https://goa.design/docs/3-tutorials/4-streaming/8-sse/

Method("stream", func() {
    Description("Stream events using Server-Sent Events")
    Payload(func() {
        Attribute("startID", String, "ID of the last event received", func() {
            Description("Used to resume streaming from a specific event")
            Example("123")
        })
    })
    StreamingResult(Event)
    HTTP(func() {
        GET("/events/stream")
        ServerSentEvents(func() {
            SSERequestID("startID") // Maps the Last-Event-Id header to startID
        })
    })
})
...
var Event = Type("Event", func() {
	Description("Cloud event created by job")
	Attribute("id", String, "Event ID")
	// Attribute("type", String, "Type of event")
	// Required("id", "type")
})

Getting the following error:

template: server-handler-init:68:20: executing "server-handler-init" at <.Method.Payload.Type.Name>: can't evaluate field Type in type string

It works fine if I remove SSERequestID("startID")

goa version:

goa version
Goa version v3.21.5

Any suggestions on what I have been missing here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions