emqx / emqx-auth-pgsql

EMQX PostgreSQL Authentication Plugin
https://www.emqx.io
Apache License 2.0
36 stars 29 forks source link

Exception with pgBouncer #197

Open daadu opened 4 years ago

daadu commented 4 years ago

Setup

EMQX: v4.0.0 Environment: k8s (installed with Helm)

Problem

emqx_auth_pgsql crashes with postgres server that is accessed via pgbouncer (in Transaction Mode). It used to work fine when using it directly with postgres server.

The crash error is as follows :

(emqx@emqx-0.emqx-headless.nh-production.svc.cluster.local)1> 2020-07-31 06:36:32.039 [error] <<"8_69_esp32_d9ab10">>@10.244.6.56:56432 [Postgres] query '"auth_query"' failed: { │
│                                          invalid_sql_statement_name,                                                                                                              │
│                                          <<"prepared statement \"auth_query\" does not exist">>,                                                                                  │
│                                          [{file,<<"prepare.c">>},                                                                                                                 │
│                                           {line,<<"512">>},                                                                                                                       │
│                                           {routine,                                                                                                                               │
│                                            <<"FetchPreparedStatement">>},                                                                                                         │
│                                           {severity,<<"ERROR">>}]}  

Should changing the mode of pgBouncer to Session or something else help with this issue?