phoenix icon indicating copy to clipboard operation
phoenix copied to clipboard

function Phoenix.HTML.FormData.to_form/2 is undefined in dev mode

Open agreif opened this issue 1 year ago • 14 comments

Environment

  • Elixir version (elixir -v): Erlang/OTP 24 [erts-12.2] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:1] [jit] Elixir 1.13.4 (compiled with Erlang/OTP 24)

  • Phoenix version (mix deps): phoenix 1.6.12 (Hex package) (mix) locked at 1.6.12 (phoenix) 2d6cf558 ok

  • Operating system: Linux nixos 5.15.60 -NixOS

Expected behavior

after installing a new phoenix app with the 'phx.gen.auth' addition in dev mode: every GET request to 'http://localhost:4000/users/log_in' should respind with the login form

Actual behavior

in dev mode: repeated call to the 'http://localhost:4000/users/log_in' URl via GET throws sometimes but quite often the following error:

[error] #PID<0.693.0> running DemoWeb.Endpoint (connection #PID<0.541.0>, stream id 51) terminated
Server: localhost:4000 (http)
Request: GET /users/log_in
** (exit) an exception was raised:
    ** (UndefinedFunctionError) function Phoenix.HTML.FormData.to_form/2 is undefined or private
        (phoenix_html 3.2.0) Phoenix.HTML.FormData.to_form(%Plug.Conn{adapter: {Plug.Cowboy.Conn, :...}, assigns: %{current_user: nil, error_message: nil, layout: {DemoWeb.LayoutView, "app.html"}}, body_params: %{}, cookies: %{"_demo_key" => "SFMyNTY.g3QAAAABbQAAAAtfY3NyZl90b2tlbm0AAAAYdE83MWxQTVVBUDlKMVVrU1J0VWpFSnpR.Ny9UdEDEgmZM5jhRIruZZLJMnwKwpi4z38oqxVAZ23U", "_hive_rec_key" => "SFMyNTY.g3QAAAABbQAAAAtfY3NyZl90b2tlbm0AAAAYQi1OQzJWR3ZobjVYR0toNzl5c293aFlO.ixPFMAmsLTBuIMDfjQtqITqG2vRxPe8t5mQPMfKqrLc"}, halted: false, host: "localhost", method: "GET", owner: #PID<0.693.0>, params: %{}, path_info: ["users", "log_in"], path_params: %{}, port: 4000, private: %{DemoWeb.Router => {[], %{Plug.Swoosh.MailboxPreview => ["mailbox"]}}, :before_send => [#Function<0.16477574/1 in Plug.CSRFProtection.call/2>, #Function<2.17183421/1 in Phoenix.Controller.fetch_flash/2>, #Function<0.77458138/1 in Plug.Session.before_send/2>, #Function<0.23023616/1 in Plug.Telemetry.call/2>, #Function<1.120844262/1 in Phoenix.LiveReloader.before_send_inject_reloader/3>], :phoenix_action => :new, :phoenix_controller => DemoWeb.UserSessionController, :phoenix_endpoint => DemoWeb.Endpoint, :phoenix_flash => %{}, :phoenix_format => "html", :phoenix_layout => {DemoWeb.LayoutView, :app}, :phoenix_request_logger => {"request_logger", "request_logger"}, :phoenix_root_layout => {DemoWeb.LayoutView, :root}, :phoenix_router => DemoWeb.Router, :phoenix_template => "new.html", :phoenix_view => DemoWeb.UserSessionView, :plug_session => %{"_csrf_token" => "tO71lPMUAP9J1UkSRtUjEJzQ"}, :plug_session_fetch => :done}, query_params: %{}, query_string: "", remote_ip: {127, 0, 0, 1}, req_cookies: %{"_demo_key" => "SFMyNTY.g3QAAAABbQAAAAtfY3NyZl90b2tlbm0AAAAYdE83MWxQTVVBUDlKMVVrU1J0VWpFSnpR.Ny9UdEDEgmZM5jhRIruZZLJMnwKwpi4z38oqxVAZ23U", "_hive_rec_key" => "SFMyNTY.g3QAAAABbQAAAAtfY3NyZl90b2tlbm0AAAAYQi1OQzJWR3ZobjVYR0toNzl5c293aFlO.ixPFMAmsLTBuIMDfjQtqITqG2vRxPe8t5mQPMfKqrLc"}, req_headers: [{"accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"}, {"accept-encoding", "gzip, deflate"}, {"accept-language", "en-US,en;q=0.5"}, {"connection", "keep-alive"}, {"cookie", "_hive_rec_key=SFMyNTY.g3QAAAABbQAAAAtfY3NyZl90b2tlbm0AAAAYQi1OQzJWR3ZobjVYR0toNzl5c293aFlO.ixPFMAmsLTBuIMDfjQtqITqG2vRxPe8t5mQPMfKqrLc; _demo_key=SFMyNTY.g3QAAAABbQAAAAtfY3NyZl90b2tlbm0AAAAYdE83MWxQTVVBUDlKMVVrU1J0VWpFSnpR.Ny9UdEDEgmZM5jhRIruZZLJMnwKwpi4z38oqxVAZ23U"}, {"host", "localhost:4000"}, {"referer", "http://localhost:4000/users/log_in"}, {"upgrade-insecure-requests", "1"}, {"user-agent", "Mozilla/5.0 (X11; Linux x86_64; rv:76.0) Gecko/20100101 Firefox/76.0"}], request_path: "/users/log_in", resp_body: nil, resp_cookies: %{}, resp_headers: [{"cache-control", "max-age=0, private, must-revalidate"}, {"x-request-id", "FxVj9rZvaHcpykMAAANx"}, {"x-frame-options", "SAMEORIGIN"}, {"x-xss-protection", "1; mode=block"}, {"x-content-type-options", "nosniff"}, {"x-download-options", "noopen"}, {"x-permitted-cross-domain-policies", "none"}, {"cross-origin-window-policy", "deny"}], scheme: :http, script_name: [], secret_key_base: :..., state: :unset, status: nil}, [as: :user])
        (phoenix_live_view 0.17.11) lib/phoenix_live_view/helpers.ex:1107: Phoenix.LiveView.Helpers.form/1
        (phoenix_live_view 0.17.11) lib/phoenix_live_view/helpers.ex:637: Phoenix.LiveView.Helpers.component/2
        (demo 0.1.0) lib/demo_web/templates/user_session/new.html.heex:3: anonymous fn/2 in DemoWeb.UserSessionView."new.html"/1
        (phoenix_live_view 0.17.11) lib/phoenix_live_view/engine.ex:124: Phoenix.HTML.Safe.Phoenix.LiveView.Rendered.to_iodata/1
        (phoenix_live_view 0.17.11) lib/phoenix_live_view/engine.ex:140: Phoenix.HTML.Safe.Phoenix.LiveView.Rendered.to_iodata/3
        (phoenix 1.6.12) lib/phoenix/controller.ex:772: Phoenix.Controller.render_and_send/4
        (demo 0.1.0) lib/demo_web/controllers/user_session_controller.ex:1: DemoWeb.UserSessionController.action/2
        (demo 0.1.0) lib/demo_web/controllers/user_session_controller.ex:1: DemoWeb.UserSessionController.phoenix_controller_pipeline/2
        (phoenix 1.6.12) lib/phoenix/router.ex:354: Phoenix.Router.__call__/2
        (demo 0.1.0) lib/demo_web/endpoint.ex:1: DemoWeb.Endpoint.plug_builder_call/2
        (demo 0.1.0) lib/plug/debugger.ex:136: DemoWeb.Endpoint."call (overridable 3)"/2
        (demo 0.1.0) lib/demo_web/endpoint.ex:1: DemoWeb.Endpoint.call/2
        (phoenix 1.6.12) lib/phoenix/endpoint/cowboy2_handler.ex:54: Phoenix.Endpoint.Cowboy2Handler.init/4
        (cowboy 2.9.0) /home/agreif/project/demo/deps/cowboy/src/cowboy_handler.erl:37: :cowboy_handler.execute/2
        (cowboy 2.9.0) /home/agreif/project/demo/deps/cowboy/src/cowboy_stream_h.erl:306: :cowboy_stream_h.execute/3
        (cowboy 2.9.0) /home/agreif/project/demo/deps/cowboy/src/cowboy_stream_h.erl:295: :cowboy_stream_h.request_process/3
        (stdlib 3.17) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
[debug] Duplicate channel join for topic "phoenix:live_reload" in Phoenix.LiveReloader.Socket. Closing existing channel for new join.

agreif avatar Sep 16 '22 16:09 agreif