Asset URLs don't include digest when deploying to Heroku using Releases

When I deploy a phoenix app to Heroku, the paths of static assets in the html are missing the digest. So instead of src="js/admin-62123d5990c2dec10fc43f27f068113c.js" I just get a plain src="js/admin.js" for MyRoutes.static_path(@conn, "/js/admin.js")

When I run the app locally with MIX_ENV=prod mix phx.server the paths are correct. So I assume it has something to do with using releases for deployment.

I use these buildpacks (in this order):

  1. https://buildpack-registry.s3.amazonaws.com/buildpacks/hashnuke/elixir.tgz
  2. GitHub - gjaldon/heroku-buildpack-phoenix-static: A Heroku buildpack for building Phoenix's static assets
  3. GitHub - chrismcg/heroku-buildpack-elixir-mix-release: A Heroku buildpack for use with Elixir 1.9+ releases

I can see in the build logs that the digest is working. I can also see the digested assets in the file system and I can access them via http. But the darn paths are not correct. The file cache_manifest.json is also generated and I set it in my endpoint configuration in prod.exs

config :my_app, MyAppWeb.Endpoint,
  http: [:inet6, port: String.to_integer(System.get_env("PORT") || "4000")],
  url: [host: host, port: String.to_integer(System.get_env("URL_PORT") || "80")],
  # be aware that if using mix ```release``` statics will be served from
  # _build/prod/rel/kurabu_app/lib/kurabu_app-0.1.0/priv/static
  static_url: [host: host, port: String.to_integer(System.get_env("URL_PORT") || "80")],
  cache_static_manifest: "priv/static/cache_manifest.json",
  secret_key_base: secret_key_base,
  server: true,
  check_origin: false

I am not sure what the reason is and how to proceed from here. I am thankful for any hints to point me in the right direction.

For completion:

elixir_buildpack.config

# Erlang version
erlang_version=22.3.4.12

# Elixir version
elixir_version=1.10.4

# Always rebuild from scratch on every deploy?
always_rebuild=false

# A command to run right after compiling the app
hook_post_compile="./heroku/hook_run_migrations.sh"

# Set the path the app is run from
runtime_path=/app

phoenix_static_buildpack.config

# Clean out cache contents from previous deploys
clean_cache=true

# We can change the filename for the compile script with this option
compile="compile"

# We can set the version of Node to use for the app here
node_version=12.14.1

# We can set the version of Yarn to use for the app here
yarn_version=1.21.1

# Remove node and node_modules directory to keep slug size down if it is not needed.
remove_node=false

# We can change phoenix mix namespace tasks. E.g. `phoenix` for phoenix < 1.3 support.
phoenix_ex=phx

compile

cd $phoenix_dir
mix compile
npm run deploy --prefix ./assets
mix "${phoenix_ex}.digest"

Well, never mind. I was an idiot and didn’t correctly configure the endpoint in releases.exs because I somehow thought prod.exs was the relevant file. And there the values for static_url and cache_static_manifest were wrong…

Conclusion: If a problem seems very hard to understand, look for an easy solution you might have missed.