Skip to content
This repository has been archived by the owner on Aug 30, 2023. It is now read-only.

Errors registering with wrong request URL (GorillaMux, CaptureError, Recovery Handler) #244

Open
nchudleigh opened this issue Mar 12, 2019 · 0 comments

Comments

@nchudleigh
Copy link

Using gorilla/mux v1.6.1

I am noticing errors come through to Sentry that have the wrong Request URL for the Handler that gets called.

The specific situation I am seeing in Sentry is Handler3 being called for a request to /two/user_1234.

The other strange thing is Handler2 is called hundreds of times per minute. But the error is raised infrequently (a couple hundred times in the past 5 days)

I have tried to replicate this locally but as I cannot mimic the functionality.

Given the implementation below is it possible that a error raised from a request is being tagged with the wrong Request URL?

If this is not the case I will move on to the gorilla/mux issues.

// Router creates router for the server
func Router() *mux.Router {
	r := mux.NewRouter()

	r.HandleFunc("/one", raven.RecoveryHandler(Handler1)).Methods("GET")
	r.HandleFunc("/two/{key}", raven.RecoveryHandler(Handler2)).Methods("GET")
	r.HandleFunc("/{id}", raven.RecoveryHandler(Handler3)).Methods("GET")
	
	return r
}

func main() {
	r := Router()

	srv := &http.Server{
		Handler:      r,
		Addr:         ":" + PORT,
		ReadTimeout:  2 * time.Second,
		WriteTimeout: 2 * time.Second,
	}

	log.Printf("Listening on http://127.0.0.1:%s\n", PORT)
	err := srv.ListenAndServe()
	if err != nil {
		log.Fatalf("ListenAndServe(): %s", err)
		raven.CaptureError(err, nil)
	}
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant