pgiesin
This should be a simple problem but I just can’t seem to figure it out. I have a standalone Elixir app that won’t find the database.
Dependencies
{:comeonin, "~> 5.1"},
{:postgrex, "~> 0.14.1"},
{:ecto_sql, "~> 3.0"},
Repo
defmodule AccountService.Repo do
use Ecto.Repo,
otp_app: :account_service,
adapter: Ecto.Adapters.Postgres
end
Config
config :account_service, AccountService.Repo,
database: "worksolvr",
username: "postgres",
password: "REDACTED",
hostname: "localhost"
When i attempt to run mix ecto.migrate I receive:
[error] GenServer #PID<0.202.0> terminating
** (RuntimeError) connect raised KeyError exception: key :database not found.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/keyword.ex:389: Keyword.fetch!/2
(postgrex) lib/postgrex/protocol.ex:90: Postgrex.Protocol.connect/1
(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
Thanks,
Peter
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
Hi everyone,
I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding.
I sta...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
I’m new to elixir and just tried to install the elixirLS extension for VScode(ium) and it is throwing some errors that I would like help ...
New
Other Trending Topics
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #ai
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #elixirconf-eu
- #metaprogramming
- #hex











Showing Posts 22 to 13- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
tenzil
Finally i did it, i deployed it in heroku. first thing i scratched the previous deploy setup and added them again, second my prod.secret.exs had config :myapp, MyAppWeb.Repo which was not commented.
Issue deploying to gigalixir - (RuntimeError) connect raised KeyError exception: key :database not found , helped when i revisited this issue.
Thanks folks.
tenzil
ohh, okay. I have not updated the config, as i was referring the old app (1.8) at first . when it didn’t workout i did few changes for the new app(1.9) then finally the app got deployed, post deployment i ran
mix ecto.setupthen found out this database not found error.One of the referred blogs.
https://github.com/dwyl/learn-heroku/blob/master/elixir-phoenix-app-deployment.md
I will scratch it out and try a new deployment specific to 1.9. Will update here once thats done.
Thanks guys
NobbZ
Okay, one question answered, last one was if you have properly updated the config into the new format.
It won’t work when you mixed things up. Either fully use 1.8 syntax or 1.9.
tenzil
No, it doesn’t use releases, I have
web: MIX_ENV=prod mix phx.serverin my procfileNobbZ
That does not answer any of my questions…
Does your buildpack use releases or
mix phx.server?Have you properly updated your config files for 1.9?
dimitarvp
I should have recommended that earlier, but I assumed you had it somewhere.
Basically, you can’t go without that. You need a database name in which your app to persist stuff!
tenzil
As its an heroku app, i just do
git push heroku masterthis does the trick.And @dimitarvp, i haven’t tried that
database: "your_db_name_here"NobbZ
How do you deploy? And have you updated your config from
Mix.ConfigtoConfig, and especially have you done that consequently for all files inconfig?dimitarvp
BTW, do you also have this in your config file?
Additionally, have you tried actually adding the
databasekey?dimitarvp
At this point I recommend you generate a new Phoenix project with
mixand using the proper switches (namely you want an Ecto Repo, use the same module and app name as your current project etc.) and then just search for the differences between your project and the freshly generated one.