elixir-ecto / db_connection

Database connection behaviour

Home Page:http://hexdocs.pm/db_connection/DBConnection.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Document :show_sensitive_data_on_connection_error

anthonator opened this issue · comments

I've been getting the following error on a staging server.

** (RuntimeError) connect raised ArgumentError exception.The exception details are hidden, as they may contain sensitive data such as database credentials. You may set :show_sensitive_data_on_connection_error to true if you wish to see all of the details
    (elixir) lib/registry.ex:1154: Registry.key_info!/1
    (elixir) lib/registry.ex:556: Registry.lookup/2
    (postgrex) lib/postgrex/type_supervisor.ex:29: Postgrex.TypeSupervisor.locate/2
    (postgrex) lib/postgrex/protocol.ex:771: Postgrex.Protocol.bootstrap/3
    (postgrex) lib/postgrex/protocol.ex:576: Postgrex.Protocol.handshake/2
    (db_connection) lib/db_connection/connection.ex:66: DBConnection.Connection.connect/2
    (connection) lib/connection.ex:622: Connection.enter_connect/5
    (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message: nil
State: Postgrex.Protocol

I've been wanting to enable the :show_sensitive_data_on_connection_error config option so I can get a helpful error message but I'm not sure how.

Pushed to master, thanks. If you are using Ecto, it is given on your repo config, for everything else, you pass it to start_link!

@anthonator have you found the issue afterwards? I am facing something similar, and the :show_sensitive_data_on_connection_error is not really helping. See my issue on postgrex.

I have the same problem with :show_sensitive_data_on_connection_error, I don't have idea where to change it to true.

@alex3o0 It's here:

children = [,
  {MyApp.Ecto.Repo, [show_sensitive_data_on_connection_error: true]},
]

opts = [strategy: :one_for_one, name: MyApp.Supervisor]
Supervisor.start_link(children, opts)

in your application supervisor

commented

also, you can put it in your DB config file:

config/runtime/dev.exs   or  config/config.exs

   database: database_api,
   hostname: hostname_api,
   /// here: 
   show_sensitive_data_on_connection_error: true