Skip to content

Commit

Permalink
chore: fix middleware order
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Phelps <[email protected]>
  • Loading branch information
markphelps committed Jun 19, 2024
1 parent 0f12ff7 commit 8988abc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/cmd/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ func NewGRPCServer(
logger.Debug("otel tracing enabled", zap.String("exporter", cfg.Tracing.Exporter.String()))
}

// base observability inteceptors
// base inteceptors
interceptors := []grpc.UnaryServerInterceptor{
grpc_recovery.UnaryServerInterceptor(grpc_recovery.WithRecoveryHandler(func(p interface{}) (err error) {
logger.Error("panic recovered", zap.Any("panic", p))
Expand All @@ -229,6 +229,7 @@ func NewGRPCServer(
})),
grpc_prometheus.UnaryServerInterceptor,
otelgrpc.UnaryServerInterceptor(),
middlewaregrpc.ErrorUnaryInterceptor,
}

if cfg.Cache.Enabled {
Expand Down Expand Up @@ -345,7 +346,6 @@ func NewGRPCServer(
// add auth interceptors to the server
interceptors = append(interceptors,
append(authInterceptors,
middlewaregrpc.ErrorUnaryInterceptor,
middlewaregrpc.FliptAcceptServerVersionUnaryInterceptor(logger),
middlewaregrpc.EvaluationUnaryInterceptor(cfg.Analytics.Enabled()),
)...,
Expand Down Expand Up @@ -473,7 +473,7 @@ func NewGRPCServer(
logger.Info("authorization middleware enabled")
}

// we validate requests before cache but after authn and authz
// we validate requests before after authn and authz
interceptors = append(interceptors, middlewaregrpc.ValidationUnaryInterceptor)

grpcOpts := []grpc.ServerOption{
Expand Down

0 comments on commit 8988abc

Please sign in to comment.