** (RuntimeError) environment variable DATABASE_URL is missing

As titled.
IDK what happened, nothing has changed, I used to start the local server many times without running into this, I believe I have been configuring the LSP a lot and when I started to rebuild (delete the _build file) this app it suddenly can’t launch into a dev server.

Database was set up, I’ve been using the same config all long without problem.

Additional error:

   (stdlib 6.2) erl_eval.erl:919: :erl_eval.do_apply/7
    (stdlib 6.2) erl_eval.erl:663: :erl_eval.expr/6
    (stdlib 6.2) erl_eval.erl:271: :erl_eval.exprs/6
    (elixir 1.18.2) lib/code.ex:572: Code.validated_eval_string/3

Help plz

This usually happens when running the application in prod (MIX_ENV=prod) in which case DATABASE_URL is required (see config/runtime.exs)

3 Likes

Thank you
Now what do I know I did set MIX_ENV to prod when building the LSP (and alas it was not even a successful attempt).

Just switched it to dev and mix phx.server works again. Thanks for the kind reminder!

1 Like