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!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
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
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
apply_graft/2 doesn’t rewrite an add_many sub-workflow’s deps on an add step. Grafted jobs cancel with “upstream job was deleted”
Version...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
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
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
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
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
- #elixirconf-us
- #blog-post
- #ai
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (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