Compilation error on guard clause during Heroku deploy

Hi everyone!

I’m pushing my Phoenix app to Heroku (not an initial deploy) and the build is failing due to a compilation error:
cannot invoke local when/2 inside match, called as: {:error, error} when :erlang.is_binary(error)

Here’s the line (It’s the first case in the else clause of a with statement):
{:error, error} when is_binary(error) ->

The strange thing is that this compilation error doesn’t happen on my local machine. I’m running Elixir 1.3.0 and Erlang 19 locally, and my elixir_buildpack.config for Heroku (using HashNuke’s heroku-buildpack-elixir) specifies Elixir 1.3.0 and Erlang 18.2.1. But I don’t think the difference in Erlang versions would be causing the problem.

It’s also strange that it thinks when/2 is a local function, though it’s called as :erlang.is_binary/1

Any ideas?

  • Aaron

Got it! Turns out this was fixed somewhere in between Elixir 1.3.0 and 1.3.2, so I just had to upgrade it in the buildpack config

Reference: https://github.com/elixir-lang/elixir/pull/4960

2 Likes