I am using heroku-buildpack-elixir to deploy an application to Heroku. My application consists of a simple Plug/Cowboy setup. I noticed that when unhandled exceptions occur, a nice error message appears, showing the stack trace and the lines of code where the error appeared.
This is ok for development environments, however on production environments I do not want my code to be visible to visitors. How can I disable or override the default behaviour?
I tried setting the MIX_ENV environment variable to prod in Heroku with no effect.
MIX_ENVin production does not make much sense since there is even nomixapplication in the first place (unless you have explicitly included it in your release, which is basically wrong in a nutshell.) - Aleksei MatiushkinMix.envhas the correct value though (look at the accepted answer). Where does it get the value from? - Raphael Müllermixis surely there andMix.envis defined. In production, there is no trail ofmixanymore. That said, in runtime there is no conditional at all, this piece of code is compiled to void AST. - Aleksei Matiushkin