I have a db with two users that are getting queried up fine, but then I get a Plug.MissingAdapter.send_resp/4 is undefined
error (new one for me). here is the complete error message:
(UndefinedFunctionError) function Plug.MissingAdapter.send_resp/4 is undefined (module Plug.MissingAdapter is not available)
Plug.MissingAdapter.send_resp(nil, 200, [{"content-type", "application/json; charset=utf-8"}, {"cache-control", "max-age=0, private, must-revalidate"}], [123, [[34, ["data"], 34], 58, [91, [[123, [[34, ["username"], 34], 58, [34, ["first_user"], 34], 44, [34, ["id"], 34], 58, "1", 44, [34, ["email"], 34], 58, [34, ["first@user.com"], 34]], 125], 44, [123, [[34, ["username"], 34], 58, [34, ["second_user"], 34], 44, [34, ["id"], 34], 58, "3", 44, [34, ["email"], 34], 58, [34, ["second@user.com"], 34]], 125]], 93]], 125])
(plug) lib/plug/conn.ex:394: Plug.Conn.send_resp/1
Is this saying that I need to create a Plug.MissingAdapter module? This is my first experiment in Phoenix 1.3 but I didn’t think things had changed that much. Although that said, setting up Guardian is proving to be much more complicated than it used to be as well.
Relevant part of controller:
defmodule MyAppWeb.UserController do
use MyAppWeb, :controller
alias MyApp.Profiles
alias MyApp.Profiles.User
alias MyAppWeb.SessionView
alias MyAppWeb.UserView
action_fallback MyAppWeb.FallbackController
def index(conn, _params) do
users = Profiles.list_users()
conn
|> put_view(UserView)
|> render("index.json", users: users)
end
and from the view:
defmodule MyAppWeb.UserView do
use MyAppWeb, :view
alias MyAppWeb.UserView
def render("index.json", %{users: users}) do
%{data: render_many(users, UserView, "user.json")}
end