I was following this guide for embedding Ejabberd into a Phoenix application (https://blog.process-one.net/embedding-ejabberd-into-an-elixir-phoenix-web-application/) and I'm having an error now that it' running.
Basically, everything appears to work fine until I navigate to "http://localhost:4000/ejabberd" at which point I get the following error:
[error] #PID<0.721.0> running EjbrdTest.Endpoint terminated Server: localhost:4000 (http) Request: GET /ejabberd ** (exit) an exception was raised: ** (Plug.Conn.AlreadySentError) the response was already sent (plug) lib/plug/conn.ex:428: Plug.Conn.resp/3 (plug) lib/plug/conn.ex:415: Plug.Conn.send_resp/3 (ejbrdTest) web/controllers/ejabberd_controller.ex:1: EjbrdTest.EjabberdController.phoenix_controller_pipeline/2 (ejbrdTest) lib/phoenix/router.ex:265: EjbrdTest.Router.dispatch/2 (ejbrdTest) web/router.ex:1: EjbrdTest.Router.do_call/2 (ejbrdTest) lib/ejbrdTest/endpoint.ex:1: EjbrdTest.Endpoint.phoenix_pipeline/1 (ejbrdTest) lib/plug/debugger.ex:90: EjbrdTest.Endpoint."call (overridable 3)"/2 (ejbrdTest) lib/phoenix/endpoint/render_errors.ex:34: EjbrdTest.Endpoint.call/2 (plug) lib/plug/adapters/cowboy/handler.ex:15: Plug.Adapters.Cowboy.Handler.upgrade/4 (cowboy) src/cowboy_protocol.erl:442: :cowboy_protocol.execute/4
And rather than a list of users, I see this in the jumbotron:
Online users: < %= for user <- @users do %> < %= user %>
< % end %>
I've not been able to find anything on this, any ideas?
Thanks. Let me know if you need any more info.
Removing plug :action
will fix the issue. Looks like it is called by default now, so that line causes a duplicate error:
https://github.com/phoenixframework/phoenix/issues/888
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With