Middleware initializes pgx/v4
rlorca opened this issue · 1 comments
rlorca commented
Preflight checklist
- I could not find a solution in the existing issues, docs, nor discussions.
- I agree to follow this project's Code of Conduct.
- I have read and am following this repository's Contribution Guidelines.
- This issue affects my Ory Network project.
- I have joined the Ory Community Slack.
- I am signed up to the Ory Security Patch Newsletter.
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':
- github.com/ory/oathkeeper/middleware
- github.com/ory/oathkeeper/driver/configuration
- github.com/ory/x/watcherx
- github.com/jackc/pgx/v4/stdlib
Any help would be appreciated.
Rodrigo
Reproducing the bug
- In a project using pgx v5
- Import "github.com/ory/oathkeeper/middleware"
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
Maybe this can help jackc/pgx#1480