sushant12

sushant12

Issue deploying to gigalixir - (RuntimeError) connect raised KeyError exception: key :database not found

I am having an issue deploying my phoenix app to gigalixir.

2019-09-24T01:05:40.350124+00:00 stipe[stipe-767f97457f-657ng]: web.1  | ** (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 when starting your connection if you wish to see all of the details
2019-09-24T01:05:40.350152+00:00 stipe[stipe-767f97457f-657ng]: web.1  |     (elixir) lib/keyword.ex:393: Keyword.fetch!/2
2019-09-24T01:05:40.350182+00:00 stipe[stipe-767f97457f-657ng]: web.1  |     (postgrex) lib/postgrex/protocol.ex:92: Postgrex.Protocol.connect/1
2019-09-24T01:05:40.350260+00:00 stipe[stipe-767f97457f-657ng]: web.1  |     (db_connection) lib/db_connection/connection.ex:69: DBConnection.Connection.connect/2
2019-09-24T01:05:40.350286+00:00 stipe[stipe-767f97457f-657ng]: web.1  |     (connection) lib/connection.ex:622: Connection.enter_connect/5
2019-09-24T01:05:40.350315+00:00 stipe[stipe-767f97457f-657ng]: web.1  |     (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
2019-09-24T01:05:40.350334+00:00 stipe[stipe-767f97457f-657ng]: web.1  | Last message: nil
2019-09-24T01:05:40.350452+00:00 stipe[stipe-767f97457f-657ng]: web.1  | 01:05:40.270 [error] GenServer #PID<0.1683.0> terminating
2019-09-24T01:05:40.350459+00:00 stipe[stipe-767f97457f-657ng]: web.1  | ** (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 when starting your connection if you wish to see all of the details
2019-09-24T01:05:40.350460+00:00 stipe[stipe-767f97457f-657ng]: web.1  |     (elixir) lib/keyword.ex:393: Keyword.fetch!/2
2019-09-24T01:05:40.350463+00:00 stipe[stipe-767f97457f-657ng]: web.1  |     (postgrex) lib/postgrex/protocol.ex:92: Postgrex.Protocol.connect/1
2019-09-24T01:05:40.350504+00:00 stipe[stipe-767f97457f-657ng]: web.1  |     (db_connection) lib/db_connection/connection.ex:69: DBConnection.Connection.connect/2
2019-09-24T01:05:40.350585+00:00 stipe[stipe-767f97457f-657ng]: web.1  |     (connection) lib/connection.ex:622: Connection.enter_connect/5
2019-09-24T01:05:40.350620+00:00 stipe[stipe-767f97457f-657ng]: web.1  |     (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
2019-09-24T01:05:40.350645+00:00 stipe[stipe-767f97457f-657ng]: web.1  | Last message: nil
2019-09-24T01:05:40.350692+00:00 stipe[stipe-767f97457f-657ng]: web.1  | 01:05:40.271 [info] Application stipe exited: shutdown
2019-09-24T01:05:40+00:00 stipe[gigalixir]: Readiness probe failed: dial tcp 10.56.12.134:4000: connect: connection refused
2019-09-24T01:05:41.359831+00:00 stipe[stipe-5c6c65949d-84thz]: web.1  | {"Kernel pid terminated",application_controller,"{application_terminated,stipe,shutdown}"}
2019-09-24T01:05:41.359881+00:00 stipe[stipe-5c6c65949d-84thz]: web.1  | Kernel pid terminated (application_controller) ({application_terminated,stipe,shutdown})
2019-09-24T01:05:41.362196+00:00 stipe[stipe-5c6c65949d-84thz]: web.1  | 
2019-09-24T01:05:41.782657+00:00 stipe[stipe-767f97457f-657ng]: web.1  | {"Kernel pid terminated",application_controller,"{application_terminated,stipe,shutdown}"}
2019-09-24T01:05:41.782745+00:00 stipe[stipe-767f97457f-657ng]: web.1  | Kernel pid terminated (application_controller) ({application_terminated,stipe,shutdown})
2019-09-24T01:05:41.786425+00:00 stipe[stipe-767f97457f-657ng]: web.1  | 
2019-09-24T01:05:43+00:00 stipe[gigalixir]: Readiness probe failed: dial tcp 10.56.12.134:4000: connect: connection refused

And this is my prod.exs file

config :stipe, StipeWeb.Endpoint,
  load_from_system_env: true,
  # Needed for Phoenix 1.2 and 1.4. Doesn't hurt for 1.3.
  http: [port: {:system, "PORT"}],
  # Without this line, your app will not start the web server!
  server: true,
  secret_key_base: "${SECRET_KEY_BASE}",
  url: [host: "${APP_NAME}.gigalixirapp.com", port: 443],
  cache_static_manifest: "priv/static/cache_manifest.json"

config :stipe, StipeWeb.Repo,
  adapter: Ecto.Adapters.Postgres,
  url: "${DATABASE_URL}",
  database: "",
  ssl: true,
  show_sensitive_data_on_connection_error: true,
  # Free tier db only allows 4 connections. Rolling deploys need pool_size*(n+1) connections where n is the number of app replicas.
  pool_size: 2

I wonder why it cant connect to db as mentioned in the logs. And even with the show_sensitive_data_on_connection_error: true, enabled I still see the enable it to show sensitive info message in the log

Also I am using distillery.

Marked As Solved

jesse

jesse

Just a guess, but try replacing StipeWeb.Repo with Stipe.Repo

Also Liked

jesse

jesse

No worries! It’s actually a very common error. I see it almost everyday.

Where Next?

Popular in Questions Top

rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" =&gt; #BSON.ObjectId&lt;58eb1a7a9ad169198c3dXXXX&gt;, "email" =&gt; ...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID&lt;0.412.0&gt; terminating ** (Postgrex.Error) FATAL...
New

Other popular topics Top

nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 31586 112
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New

We're in Beta

About us Mission Statement