Trouble running umbrella app on Heroku

Tags: #<Tag:0x00007f1142e50f10>


I am trying to deploy an umbrella app on Heroku. Got it to build after some tweaking, but then it immediately crashes. My Procfile command is iex -S mix phoenix.server which is what I run locally in the umbrella root to start the phoenix app and one other Genserver app. Below is the error message.

This part – exec: /app/_build/.platform_tools/erlang/erts-8.3/bin/erlexec: not found is probably signifcant, but I don’t know how to act on it.

2017-04-21T02:12:13.000000+00:00 app[api]: Build succeeded
2017-04-21T02:13:20.881492+00:00 heroku[web.1]: Starting process with command `mix phoenix.server`
2017-04-21T02:13:23.395443+00:00 app[web.1]: /app/.platform_tools/erlang/bin/erl: 29: exec: /app/_build/.platform_tools/erlang/erts-8.3/bin/erlexec: not found
2017-04-21T02:13:23.492264+00:00 heroku[web.1]: State changed from starting to crashed
2017-04-21T02:13:23.484901+00:00 heroku[web.1]: Process exited with status 127
2017-04-21T02:13:29.258847+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" request_id=c5967d69-2bdd-4077-b500-9b61f4a432e2 fwd="" dyno= connect= service= status=503 bytes= protocol=https
2017-04-21T02:13:29.538362+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" request_id=57c7b6c6-f02b-4c02-bace-6dbbdc414d65 fwd="" dyno= connect= service= status=503 bytes= protocol=https


Here is what I typically use in my Procfile for my Heroku projects.

web: MIX_ENV=prod mix phoenix.server


Thanks – I tried that, but still got an error (below). It must have to do with the way I’ve set up my umbrella app. I’ve tried to follow the advice at this post

2017-04-21T03:16:42.116701+00:00 heroku[web.1]: Starting process with command `mix phoenix.server`
2017-04-21T03:16:43.925696+00:00 app[web.1]: /app/.platform_tools/erlang/bin/erl: 29: exec: /app/_build/.platform_tools/erlang/erts-8.3/bin/erlexec: not found
2017-04-21T03:16:43.964724+00:00 heroku[web.1]: Process exited with status 127
2017-04-21T03:16:43.972560+00:00 heroku[web.1]: State changed from starting to crashed


Hmm, not sure. I got my alexa_api umbrella app deployed and working on Heroku. I cd’d into my Phoenix app like the post says (I think I used that post as well), but I don’t think cd’ing into the Phoenix app is necessary.

web: cd apps/web && MIX_ENV=prod mix phoenix.server


Yes, I tried the cd version just as you have it, but with the same error. I think that the key is this error message:

exec: /app/_build/.platform_tools/erlang/erts-8.3/bin/erlexec: not found

I will keep fiddling around with this – encouraging that you got your umbrella app deployed. What version of Erlang did you specify?


What buildpacks are you using? I have a few umbrella apps deployed to Heroku using the following buildpacks (order matters, so make sure the elixir buildpack is first):

If you use the phoenix buildpack above you’ll need to set phoenix_relative_path=. in your phoenix_static_buildpack.config file to the path of your phoenix app (e.g. phoenix_relative_path=apps/phoenix)


For the buildpacks, I have

jxxmbp:ns_umbrella carlson$ heroku buildpacks
=== still-badlands-67960 Buildpack URLs

Then in phoenix_static_buildpack.config at root level, I have


where apps/lookup_phoenix leads to my app.

Seems the same, no?


The error that I consistently get is

/app/.platform_tools/erlang/bin/erl: 29: exec: /app/_build/.platform_tools/erlang/erts-8.3/bin/erlexec: not found

This indicates to me that heroku’s build process is looking for some erlang code that it can’t find. ???


Have you read this?

It looks like you need to add a elixir_buildpack.config file.



martinm – Thank you very much. I’ve gotten much further with the help of your advice. The remaining issue, I believe, has to do with a secrete_key_base as described in the error message below. I do have SECRET_KEY_BASE set by heroku config – I am trying to run this down now. Do you know where conn.secret_key_base in lib/plug/session/cookie.ex is set?

** (ArgumentError) cookie store expects conn.secret_key_base 
to be at least 64 bytes


What does your config/prod.exs file look like?


Here it is:

# This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
# This configuration file is loaded before any dependency and
# is restricted to this project.
use Mix.Config

# General application configuration
config :lookup_phoenix,
  ecto_repos: [LookupPhoenix.Repo]

# Configures the endpoint
config :lookup_phoenix, LookupPhoenix.Endpoint,
  url: [host: "localhost"],
  secret_key_base: "-- a long string here --",
  render_errors: [view: LookupPhoenix.ErrorView, accepts: ~w(html json)],
  pubsub: [name: LookupPhoenix.PubSub,
           adapter: Phoenix.PubSub.PG2]

# Configures Elixir's Logger
config :logger, :console,
  format: "$time $metadata[$level] $message\n",
  metadata: [:request_id]

# Import environment specific config. This must remain at the bottom
# of this file so it overrides the configuration defined above.
import_config "#{Mix.env}.exs"

I notice that the secret key base here is different from the one set in heroku config:set


Is that prod.exs and not config.exs? If it is then it’s not reading the environment variables. You need to change

secret_key_base: "-- a long string here --"


secret_key_base: System.get_env("SECRET_KEY_BASE")


I’ve set secret_key_base to System.get_env("SECRET_KEY_BASE") in both prod.exs and config.exs – but still get the same error. … am mystified – don’t see where else it might be set.

As a check – it is SECRET_KEY_BASE in my Heroku env variables


Are the file contents you showed actually config.exs and not prod.exs? If so then check the bottom of prod.exs to see if it’s importing prod.secret.exs. That could be overriding the secret_key_base.

If not, try just putting a value in manually to test. You can generate a value using

mix phx.gen.secret


I finally got it working. There were three steps (that I remember).

  1. Carefully follow the advice you sent in

  1. Reduce the pool size. Instead of 18, I used 10. Am not sure what the real value should be.

  2. Increase the key length in heroku config:set SECRET_KEY_BASE=... . I ran mix phoenix.gen.secret again and used about about a 2-inch substring, which I appended t the usual string.

However, I do have one more question. I can no longer run the app in development since it is not reading the secret. Is there a good way of switching back and forth between local development and remote production?


How have you set the secret_key_base in config/config.exs? That should just be a string value generated by the secret generator. Running locally in dev mode (which is the default) is just the usual

mix phx.server

Only in production do you need to read from environment variables.


All working now – thanks so much!