From 159677ca96aa8dbb26a0dcdd8835568a19bca41e Mon Sep 17 00:00:00 2001 From: Jordan Ribbink Date: Tue, 14 Nov 2023 16:33:24 -0800 Subject: [PATCH] Fix session bug --- go.mod | 1 - go.sum | 2 -- middleware/monitoring/sentry.go | 5 +++-- server/server.go | 12 ++++++------ 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/go.mod b/go.mod index 449cdccf..71df6f6f 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,6 @@ require ( github.com/go-chi/httplog v0.2.5 github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da github.com/google/uuid v1.3.1 - github.com/gorilla/mux v1.8.1 github.com/gorilla/sessions v1.2.0 github.com/gorilla/websocket v1.5.0 github.com/icza/bitio v1.1.0 diff --git a/go.sum b/go.sum index 9196e8dc..7985a760 100644 --- a/go.sum +++ b/go.sum @@ -455,8 +455,6 @@ github.com/googleapis/gax-go/v2 v2.11.0 h1:9V9PWXEsWnPpQhu/PeQIkS4eGzMlTLGgt80cU github.com/googleapis/gax-go/v2 v2.11.0/go.mod h1:DxmR61SGKkGLa2xigwuZIQpkCI2S5iydzRfb3peWZJI= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= -github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= github.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyCS8BvQ= github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= github.com/gorilla/sessions v1.2.0 h1:S7P+1Hm5V/AT9cjEcUD5uDaQSX0OE577aCXgoaKpYbQ= diff --git a/middleware/monitoring/sentry.go b/middleware/monitoring/sentry.go index 7d506220..f0a27979 100644 --- a/middleware/monitoring/sentry.go +++ b/middleware/monitoring/sentry.go @@ -19,10 +19,11 @@ package monitoring import ( + "net/http" + sentryhttp "github.com/getsentry/sentry-go/http" - "github.com/gorilla/mux" ) -func Middleware() mux.MiddlewareFunc { +func Middleware() func(http.Handler) http.Handler { return sentryhttp.New(sentryhttp.Options{}).Handle } diff --git a/server/server.go b/server/server.go index 09b9a795..e66b3ee0 100644 --- a/server/server.go +++ b/server/server.go @@ -21,16 +21,17 @@ package main import ( "context" "fmt" - "github.com/dapperlabs/flow-playground-api" + "log" + "net/http" + "strings" + "time" + + playground "github.com/dapperlabs/flow-playground-api" "github.com/dapperlabs/flow-playground-api/server/config" "github.com/dapperlabs/flow-playground-api/server/ping" "github.com/dapperlabs/flow-playground-api/telemetry" "github.com/prometheus/client_golang/prometheus/promhttp" "go.opentelemetry.io/otel/sdk/trace" - "log" - "net/http" - "strings" - "time" "github.com/go-chi/httplog" @@ -170,7 +171,6 @@ func main() { r.Use(httpcontext.Middleware()) r.Use(sessions.Middleware(cookieStore)) - r.Use(monitoring.Middleware()) r.Handle( "/",