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
Hello!
Suppose you are building workflow (order / task / payment) processing system with the following requirements:
Each workflow con...
New
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
Hey guys,
I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly
Do you guys have any suggestions what is the best prac...
New
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app?
Looking for hints regarding:
Addi...
New
Kia ora,
We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
Hi all, I wanted to ask how the community is dealing with post-release steps.
Today we have Ecto migrations, which make sure that the db...
New
Other Trending Topics
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
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #phoenix_html
- #iex
- #ai
- #graphql
- #genstage
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex










Showing Posts 1 to 10- Show Best Posts
- Show All Posts (oldest first)
- Show All Posts (newest first)
scottming
Did you create the db?
schaary
I miss the line
in your
config/config.exfile.Sanjer
Ensure the below and give it a re-try.
STEP 1. Define the dependencies required, mix.exs
STEP 2. Get the dependencies defined above
mix deps.getSTEP 3. Configure the Repo the application
config :helloapp, ecto_repos: [HelloApp.Repo]Note: the :helloapp must be match the app name defined in the application.ex file. In my case I have created the application using the below command
mix new hello app --app hello app --supSTEP 4. Configure the the Repo itself defined above
STEP 4. Define the HelloApp.Repo module in repo.ex file in /lib/{app name}
STEP 5. Now, lets create the database
mix ecto.createThe output should be as below.
Compiling 1 file (.ex)
Generated helloapp app
The database for HelloApp.Repo has already been created.
Hope it helps somebody.
tenzil
Hi folks, I facing the following error with heroku. in local the app connects with db and running fine, only with heroku its throwing the following error.
I am unable to execute mix ecto.setup,
i do have another app running fine in heroku, i followed the same setups but its not connecting for the new app
Anyone facing the same error, I even updated my postgrex in mix
dimitarvp
Post your entire
prod.exs(without the secrets)? Seems like a straightforward case of not having the:databaseconfiguration key in the file.tenzil
Heroku uses url which has database, host, user, and password. which worked fine in elixir 1.8 phoenix app but not in 1.9 phoenix app
dimitarvp
Are you sure your app’s atom name is
:MyAppand not:myapp?Can you also show your
MyAppRepo.exfile?tenzil
yeah its “config :myapp, MyApp.Repo”
its a typo.
This works fine in dev env (local ), but it gets deployed in heroku as well, but just not getting connected with database.
dimitarvp
I am assuming you have a
DATABASE_URLenvironment variable in your Heroku configuration?tenzil
yes, i do have. dont know why its not connecting