Umbrella app Jason warning

I recently converted an existing application to an umbrella, and when I compile it - I see the following warning:

warning: failed to load Jason for Phoenix JSON encoding
(module Jason is not available).

Ensure Jason exists in your deps in mix.exs,
and you have configured Phoenix to use it for JSON encoding by
verifying the following exists in your config/config.exs:

    config :phoenix, :json_library, Jason


  (phoenix) lib/phoenix.ex:40: Phoenix.start/2
  (kernel) application_master.erl:277: :application_master.start_it_old/4

In config/config.exs I have
config :phoenix, :json_library, Jason
and mix.exs of the web app has {:jason, "~> 1.0"}

Not sure why the warnings are appearing.

Had that problem a while ago, had to move jason to the mix.exs of the Phoenix app. Not in the root, not in any of the other apps in the umbrella. Had to be exactly in the Phoenix app.

1 Like

By phoenix app, you mean the web app, right?

For me it did not help.
in apps/web/mix.exs I have {:jason, "~> 1.0"}
Also nowhere else I add jason.

And in root config/config.exs I have config :phoenix, :json_library, Jason

Still getting the errors. But the app runs fine btw.

And if you rebuild the umbrella?

rm -rf _build deps
mix do deps.get, compile

I’m rebuilding it from scratch in a clean Docker container. With --no-cache

Hmm. Now that I think about it more - I am not copying confix.exs for the initial compilation. Probably I should.

2 Likes

Yes, That fixed it! Thanks @dimitarvp