ory / oathkeeper

A cloud native Identity & Access Proxy / API (IAP) and Access Control Decision API that authenticates, authorizes, and mutates incoming HTTP(s) requests. Inspired by the BeyondCorp / Zero Trust white paper. Written in Go.
https://www.ory.sh/?utm_source=github&utm_medium=banner&utm_campaign=hydra
Apache License 2.0
3.25k stars 359 forks source link

Middleware initializes pgx/v4 #1064

Open rlorca opened 1 year ago

rlorca commented 1 year ago

Preflight checklist

Describe the bug

Hi,

I'm a new user, trying to add oathkeeper middleware to a gRPC service, but the application crashes during startup, before any explicit call to oathkeeper code.

As shown in the logs below, sql driver 'pgx' is being registered twice, once by the app and again by the middleware.

My application uses pgx v5, but one of oathkeeper's dependencies (x/watcherx) is loading v4, as shown by 'mod why':

Any help would be appreciated.

Rodrigo

Reproducing the bug

Relevant log output

panic: sql: Register called twice for driver pgx

goroutine 1 [running]:
database/sql.Register({0x2ae2b40, 0x3}, {0x2dfade0, 0xc000010258})
        /go/go1.20/src/database/sql/sql.go:51 +0x225
github.com/jackc/pgx/v4/stdlib.init.0()
        /go/pkg/mod/github.com/jackc/pgx/v4@v4.17.2/stdlib/sql.go:87 +0x11a
Exiting.

Relevant configuration

No response

Version

v0.40.1

On which operating system are you observing this issue?

macOS

In which environment are you deploying?

Other

Additional Context

No response

mcdoker18 commented 1 year ago

Maybe this can help https://github.com/jackc/pgx/issues/1480