Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Middleware initializes pgx/v4 #1064

Open
4 of 6 tasks
rlorca opened this issue Feb 8, 2023 · 1 comment
Open
4 of 6 tasks

Middleware initializes pgx/v4 #1064

rlorca opened this issue Feb 8, 2023 · 1 comment
Labels
bug Something is not working.

Comments

@rlorca
Copy link

rlorca commented Feb 8, 2023

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':

  • 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

@rlorca rlorca added the bug Something is not working. label Feb 8, 2023
@mcdoker18
Copy link

Maybe this can help jackc/pgx#1480

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working.
Projects
None yet
Development

No branches or pull requests

2 participants