-
Notifications
You must be signed in to change notification settings - Fork 245
Closed
Labels
BugIssue typeIssue type
Description
Summary
I have a service service mixed REST and Websocket requests over a single http.Server.
The sentry-go is setup the following way:
srv.Server = &http.Server{
Handler: sentryhttp.New(sentryhttp.Options{
Repanic: true,
WaitForDelivery: false,
Timeout: 30 * time.Second,
}).Handle(m),
// ...Websocket endpoint is using nhooyr/websocket to accept websocket connection, and it is pretty straightforward:
func (s *Server) createSubscription(w http.ResponseWriter, r *http.Request) {
// ...
conn, err := websocket.Accept(w, r, &websocket.AcceptOptions{
CompressionMode: websocket.CompressionContextTakeover,
})
if err != nil {
shared.Errorf(w, r, http.StatusInternalServerError, "failed to accept websocket connection: %w", err)
return
}After upgrading from 0.27.0 to 0.28.0 the above endpoint no longer works, every request fails with:
failed to accept websocket connection: failed to accept WebSocket connection: http.ResponseWriter does not implement http.Hijacker
The reason is that go-sentry started overriding http.ResponseWriter which is now of the following type:
struct { httpsnoop.Unwrapper; http.ResponseWriter }{Unwrapper:(*httpsnoop.rw)( 0xc00039e6e0), ResponseWriter:(*httpsnoop.rw)( 0xc00039e6e0)}
Which clearly does not implement http.Hijacker interface.
Steps To Reproduce
- have a working websocket server
- upgrade sentry-go to 0.28.0
- ???
- no profit
Expected Behavior
- profit
Screenshots
n/a
Sentry.io Event
n/a
Environment
important
SDK
sentry-goversion: 0.28.0- Go version: go1.22.3
- Using Go Modules? yes
Sentry
- Using hosted Sentry in sentry.io? yes
- Anything particular to your environment that could be related to this issue? n/a
Additional context
n/a
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugIssue typeIssue type
Fields
Give feedbackNo fields configured for issues without a type.
Projects
Status
No status