goadesign / goadesign/goa

Error while using `SSERequestID` with `ServerSentEvents`

Open
#3,753 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
6.1k
Forks
583
Avg merge
2d 10h
Merged PRs (30d)
15

Description

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?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.