recently I've begun getting plenty of errors in the console:
[error] Ranch protocol #PID<0.680.0> of listener MyAppWeb.Endpoint.HTTP (cowboy_clear) terminated
** (exit) an exception was raised:
** (UndefinedFunctionError) function Poison.decode!/1 is undefined (module Poison is not available)
Poison.decode!("[\"3\",\"3\",\"phoenix:live_reload\",\"phx_join\",{}]")
(phoenix) lib/phoenix/socket/serializers/v2_json_serializer.ex:30: Phoenix.Socket.V2.JSONSerializer.decode!/2
(phoenix) lib/phoenix/transports/websocket.ex:126: Phoenix.Transports.WebSocket.ws_handle/3
(phoenix) lib/phoenix/endpoint/cowboy2_websocket.ex:44: Phoenix.Endpoint.Cowboy2WebSocket.websocket_handle/2
(cowboy) /home/user_123/my_app/deps/cowboy/src/cowboy_websocket.erl:454: :cowboy_websocket.handler_call/6
(cowboy) /home/user_123/my_app/deps/cowboy/src/cowboy_http.erl:201: :cowboy_http.loop/2
(stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
mix
defp deps do
[
{:phoenix, github: "phoenixframework/phoenix", override: true},
{:phoenix_pubsub, "~> 1.0"},
{:phoenix_ecto, "~> 3.3"},
{:postgrex, "~> 0.13.5"},
{:phoenix_html, "~> 2.11"},
{:phoenix_live_reload, "~> 1.1", only: :dev},
{:gettext, "~> 0.15.0"},
{:cowboy, "~> 2.4", override: true},
{:yamerl, "~> 0.7.0"},
{:earmark, "~> 1.2"},
{:edeliver, "~> 1.5"},
{:distillery, "~> 1.5"},
{:httpoison, "~> 1.1"},
{:swoosh, "~> 0.15"},
{:gen_smtp, "~> 0.12.0"}
]
end
I think the reason is you had a project generated before 1.4-dev and now that you depend on master you'll need to do the following:
{:jason, "~> 1.0"}, to your mix.exs depsconfig :phoenix, :json_library, Jason to your config/config.exsand you should be good to go. You can of course still use Poison, but Jason is recommended and is the default for new 1.4 projects.
Didn't work, the error remained. Adding poison in dependencies - worked.
El 14 de julio de 2018 1:24:44 GMT+07:00, Wojtek Mach notifications@github.com escribi贸:
I think the reason is you had a project generated before 1.4-dev and
now that you depend on master you'll need to do the following:
- add
{:jason, "~> 1.0"},to yourmix.exsdeps- add
config :phoenix, :json_library, Jasonto your
config/config.exsand you should be good to go. You can of course still use Poison, but
Jason is recommended and is the default for new 1.4 projects.--
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
https://github.com/phoenixframework/phoenix/issues/2960#issuecomment-404914686
--
Enviado desde mi dispositivo Android con K-9 Mail. Por favor, disculpa mi brevedad.
As @wojtekmach said, 1.4 promotes Jason as the default encoder and following his steps should work but you may need to mix clean first. Phoenix also falls back to Poison if no configuration has been set, which requires Poison in your deps. We will be sure to highlight these changes in the upgrade guide. Thanks!
I know what he said. And I said - that didn't work.
Thanks @wojtekmach @chrismccord. It worked for me 馃憤
I'm running into the same issue, but as @GildedHonour already mentioned: adding poison in dependencies works for now. Thanks
I just updated phoenix_swagger and started getting this error. My project was created post 1.4 so I already have the Json configured in mix.exs and config.exs.
To fix the issue I had to add:
{:poison, "~> 3.1"}
to my deps in mix.exs
Most helpful comment
I think the reason is you had a project generated before 1.4-dev and now that you depend on master you'll need to do the following:
{:jason, "~> 1.0"},to yourmix.exsdepsconfig :phoenix, :json_library, Jasonto yourconfig/config.exsand you should be good to go. You can of course still use Poison, but Jason is recommended and is the default for new 1.4 projects.