Configuration problem for Heroku

Hi, one more error in my heroku deploy:

== Compilation error on file lib/koko/repo.ex ==
remote: ** (ArgumentError) missing :adapter configuration in config :koko, Koko.Repo
remote:     lib/ecto/repo/supervisor.ex:50: Ecto.Repo.Supervisor.compile_config/2
remote:     lib/koko/repo.ex:2: (module)
remote:     (stdlib) erl_eval.erl:670: :erl_eval.do_apply/6

The file lib/koko/repo.ex is

defmodule Koko.Repo do
  use Ecto.Repo, otp_app: :koko
  def init(_, opts) do
    {:ok, Keyword.put(opts, :url, System.get_env("DATABASE_URL"))}

Have you configured the adapter for the repo in any of the config files read in prod?

I have the below in apps/koko_web/config/prod.exs, but maybe it should be in ``apps/koko/config/prod.exs`, i.e., maybe (2) should be like (1)??

(1) apps/koko_web/config/prod.exs

config :koko_web, Koko.Web.Endpoint,
  http: [port: {:system, "PORT"}],
  on_init: {Koko.Web.Endpoint, :load_from_system_env, []},
  url: [scheme: "https", host: "", port: 443],
  force_ssl: [rewrite_on: [:x_forwarded_proto]],
  cache_static_manifest: "priv/static/cache_manifest.json",
  secret_key_base: Map.fetch!(System.get_env(), "SECRET_KEY_BASE")

(2) apps/koko/config/prod.exs

config :hello, Koko.Repo,
  adapter: Ecto.Adapters.Postgres,
  url: System.get_env("DATABASE_URL"),
  pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"),
  ssl: true

Oops – :hello should be :koko

So adjusting the app name works?

1 Like

That was it … I overlooked the app name. I have one more problem now, as the error below shows. I use the app mostly to serve json, but there are a few barebones html pages served which use assets in here:

 $ tree -L 2 apps/koko_web/priv
├── gettext
│   ├── en
│   └── errors.pot
└── static
    ├── css
    └── js

It looks like Heroku is looking for an assets folder.

 -----> Building dependencies
remote:        Installing and caching node modules
remote: /app/tmp/buildpacks/abc8fb9e8be131ec2574c4ba9e31b81540d97b3bbce47d96e05959c4f81404ac71605dd35ebbcf7a1abe958c346d8ee266ff035de9254424eb54e8b9480059be/lib/ line 105: cd: /tmp/build_5ac443444d563fb39531eea19bf25c13/./assets: No such file or directory

Yes, adjusting the app name fixed that problem. Thanks!

(my bad – should be more careful)