Gotchas with Mix Tasks?

I’m experiencing something strange… when I go into iex and import my module and run it, it works. But when I load up the same module and pass it the same input from a mix task, I get an error. Is there anything different between how these two operate? The modules use ENV vars, and oddly, the specific error comes from HttPoison. Anyone ever run into weird behaviors when code is called in different ways?

How are you using the ENV vars? If they are used in e.g. module attributes, note that they will be set at compile time, not runtime. That may be different when using mix tasks vs IEx.

Make sure you start applications you depend on.


Wow, that was it. Totally wouldn’t have thought of that. Thanks!