github event source panics on bad github input
lionelvillard opened this issue · 1 comments
lionelvillard commented
Copied from knative/eventing-contrib#538
When the incoming github event is missing the X-Github-Delivery header it generates a panic:
2019/08/11 22:30:07 Invalid payload in github event
2019/08/11 22:30:07 http: panic serving 127.0.0.1:56922: id is required to be a non-empty string
goroutine 37 [running]:
net/http.(*conn).serve.func1(0xc0004861e0)
/usr/local/go/src/net/http/server.go:1769 +0xc9
panic(0xc4b2e0, 0xc000448120)
/usr/local/go/src/runtime/panic.go:522 +0x1b5
github.com/knative/eventing-contrib/vendor/github.com/cloudevents/sdk-go/pkg/cloudevents.(*Event).SetID(...)
/home/prow/go/src/github.com/knative/eventing-contrib/vendor/github.com/cloudevents/sdk-go/pkg/cloudevents/event_writer.go:55
github.com/knative/eventing-contrib/contrib/github/pkg/adapter.(*Adapter).handleEvent(0xc0003ad980, 0x0, 0x0, 0xc0004444e0, 0x0, 0x0)
/home/prow/go/src/github.com/knative/eventing-contrib/contrib/github/pkg/adapter/adapter.go:82 +0x602
github.com/knative/eventing-contrib/contrib/github/pkg/adapter.(*Adapter).HandleEvent(0xc0003ad980, 0x0, 0x0, 0xc0004444e0)
/home/prow/go/src/github.com/knative/eventing-contrib/contrib/github/pkg/adapter/adapter.go:66 +0x4d
main.main.func1(0xefd0a0, 0xc0004e6000, 0xc000492300)
/home/prow/go/src/github.com/knative/eventing-contrib/contrib/github/cmd/receive_adapter/main.go:123 +0xc2
net/http.HandlerFunc.ServeHTTP(0xc0003ad9c0, 0xefd0a0, 0xc0004e6000, 0xc000492300)
/usr/local/go/src/net/http/server.go:1995 +0x44
net/http.(*ServeMux).ServeHTTP(0x15b1380, 0xefd0a0, 0xc0004e6000, 0xc000492300)
/usr/local/go/src/net/http/server.go:2375 +0x1d6
net/http.serverHandler.ServeHTTP(0xc000315c70, 0xefd0a0, 0xc0004e6000, 0xc000492300)
/usr/local/go/src/net/http/server.go:2774 +0xab
net/http.(*conn).serve(0xc0004861e0, 0xf015a0, 0xc00043e340)
/usr/local/go/src/net/http/server.go:1878 +0x84c
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:2884 +0x2f4
It would be nice if instead of a panic it printed a nicer error (either back on the http response or to stdout) saying which HTTP header was missing. Mentioning "id" in the panic doesn't help since the incoming header doesn't have ID in it.
github-actions commented
This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Reopen the issue with /reopen
. Mark the issue as
fresh by adding the comment /remove-lifecycle stale
.