Phoenix app won't deploy

Hi there,

I am at a loss why my Phoenix application, using releases, won’t deploy. From time to time the logs show this error:

May 21 11:36:06 AM Module build failed (from ./node_modules/sass-loader/dist/cjs.js): May 21 11:36:06 AM Error: Node Sass does not yet support your current environment: Linux 64-bit with Unsupported runtime (93)

This is minor although pretty weird since I get this error 1 out of 5 times, and Render wants me to use node-sass 4.14.1

But mostly I can’t connect with the database:

# ** (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

I have set :show_sensitive_data_on_connection_error to true, but no details appear during deployment.

From the shell I can connect with the database with the internal connection string. So the database is up and running fine.

Although I get the message “Release created at _build/prod/rel/******!”, no _build folder is created!

I am out of ideas after struggling for many hours. Help is appreciated,




Hi @CasperKaandorp ,

It looks like your app’s production config (possibly located in config/prod.exs) is missing the name of the database. Are you setting the database: in your prod config? Are you able to share your config so I can take a look? Please feel free to edit out any sensitive data from it before sharing :slight_smile:

Hey Dan, thanks for replying. I set it in the releases.ex file.


use Mix.Config

config :fake_chains, FakeChainsWeb.Endpoint,
  url: [host: System.get_env("RENDER_EXTERNAL_HOSTNAME") || "localhost", port: 80],
  cache_static_manifest: "priv/static/cache_manifest.json"

# Do not print debug messages in production
config :logger, level: :info`


import Config

database_url =
  System.get_env("DATABASE_URL") ||
    raise """
    environment variable DATABASE_URL is missing.
    For example: ecto://USER:PASS@HOST/DATABASE

config :fake_chains, FakeChains.Repo,
  ssl: true,
  url: database_url,
  pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"),
  show_sensitive_data_on_connection_error: true

secret_key_base =
  System.get_env("SECRET_KEY_BASE") ||
    raise """
    environment variable SECRET_KEY_BASE is missing.
    You can generate one by calling: mix phx.gen.secret

config :fake_chains, FakeChainsWeb.Endpoint,
  http: [
    port: String.to_integer(System.get_env("PORT") || "4000"),
    transport_options: [socket_opts: [:inet6]]
  secret_key_base: secret_key_base

# ## Using releases (Elixir v1.9+)
# If you are doing OTP releases, you need to instruct Phoenix
# to start each relevant endpoint:

config :fake_chains, FakeChainsWeb.Endpoint, server: true

DATABASE_URL etc are set



After building, the releases file isn’t executed on Render. However, if I build with the file locally releases.exs -is- executed. (I have followed this recipe: Deploy a Phoenix App | Render · Cloud Hosting for Developers, and it worked prefectly for a previous application)


Thanks for providing the extra info. It’s great you were able to narrow it down to executing the releases.exs file. Since I’m not too familiar with Elixir, I’m not sure what its process is for deciding which files to execute, unfortunately.

It may be useful to compare your previous application that worked correctly with your broken one, to see if there’s any difference in the configuration or file structure that sticks out to you.

After a lot of frustration I have found the cause of my problem. Besides the weird node problem I kept on getting this:

May 22 09:08:10 PM  19:08:10.253 [error] GenServer #PID<0.251.0> terminating
May 22 09:08:10 PM  ** (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
May 22 09:08:10 PM      (elixir) lib/keyword.ex:393: Keyword.fetch!/2
May 22 09:08:10 PM      (postgrex) lib/postgrex/protocol.ex:161: Postgrex.Protocol.connect_endpoints/6
May 22 09:08:10 PM      (db_connection) lib/db_connection/connection.ex:82: DBConnection.Connection.connect/2
May 22 09:08:10 PM      (connection) lib/connection.ex:622: Connection.enter_connect/5
May 22 09:08:10 PM      (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
May 22 09:08:10 PM  Last message: nil

key :database not found.

This has nothing to do with releases.exs, nor the build script. In lib/repo.ex you have to add an init function:

defmodule FakeChains.Repo do
    use Ecto.Repo,
        otp_app: :fake_chains,
        adapter: Ecto.Adapters.Postgres
    def init(_type, config) do
        {:ok, Keyword.put(config, :url, System.get_env("DATABASE_URL"))}

Dear, I find it pretty annoying that this documentation: Deploy a Phoenix App | Render · Cloud Hosting for Developers doesn’t show what needs to be done if your app uses a database. I mean, come on, the majority of all your phoenix apps probably have a database. And yes, I am writing this pretty pissed off.


1 Like

I’ll echo Casper’s frustration here. It looks like that step is included with the Distillery docs, but not in the standard Phoenix releases documentation. Can you just update the Mix Releases documentation to include setting up the database as well? I assume most Phoenix apps are not without a database.