elixir-ecto / db_connection

Database connection behaviour
http://hexdocs.pm/db_connection/DBConnection.html
309 stars 112 forks source link

Document :show_sensitive_data_on_connection_error #185

Closed anthonator closed 5 years ago

anthonator commented 5 years ago

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.

josevalim commented 5 years ago

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!

jeroenbourgois commented 5 years ago

@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.

alex3o0 commented 5 years ago

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

TylerTemp commented 3 years ago

@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

sg552 commented 1 year ago

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