Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Panic in fasthttp handler #911

Closed
ainar-g opened this issue Nov 29, 2024 · 1 comment · Fixed by #912
Closed

Panic in fasthttp handler #911

ainar-g opened this issue Nov 29, 2024 · 1 comment · Fixed by #912
Assignees

Comments

@ainar-g
Copy link

ainar-g commented Nov 29, 2024

Summary

The fasthttp integration can panic when converting a fasthttp context into an *http.Request.

Steps To Reproduce

If the URL parsing fails at

r.URL, _ = url.Parse(fmt.Sprintf("%s://%s%s", uri.Scheme(), uri.Host(), uri.Path()))

this panics,

r.URL.RawQuery = string(ctx.URI().QueryString())

and while that panic is caught,

defer func() {
if err := recover(); err != nil {
sentry.Logger.Printf("%v", err)
}
}()

that means that this line panics now, since r is now nil.

sentry.ContinueTrace(hub, r.Header.Get(sentry.SentryTraceHeader), r.Header.Get(sentry.SentryBaggageHeader)),

Expected Behavior

No panics.

Screenshots

[not applicable]

Sentry.io Event

[not applicable]

Environment

SDK

  • sentry-go version: v0.29.1
  • Go version: Go 1.23.3
  • Using Go Modules? yes

Sentry

[not applicable]

Additional context

The solution is to either always return a non-nil request from convert or not expect that r is always non-nil in Handle.

@cleptric
Copy link
Member

cleptric commented Dec 3, 2024

A fix was released in version 0.30.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants