tfwright / live_admin

Low-config admin UI for Phoenix apps, built on LiveView
MIT License
258 stars 25 forks source link

Add Bandit Support #83

Closed Rio517 closed 10 months ago

Rio517 commented 10 months ago

There may be an issue with live_admin when switching to bandit. I get this when loading any live_admin page:

[error] GenServer #PID<0.1178.0> terminating
** (FunctionClauseError) no function clause matching in Bandit.HTTP1.Handler.handle_info/2
    (bandit 1.0.0) /myapp/deps/thousand_island/lib/thousand_island/handler.ex:5: Bandit.HTTP1.Handler.handle_info(:clear_flash, {%ThousandIsland.Socket{socket: #Port<0.34>, transport_module: ThousandIsland.Transports.TCP, read_timeout: 60000, silent_terminate_on_error: false, span: %ThousandIsland.Telemetry{span_name: :connection, telemetry_span_context: #Reference<0.227480821.3738697732.157881>, start_time: -576460716151695028, start_metadata: %{remote_port: 40614, remote_address: {127, 0, 0, 1}, telemetry_span_context: #Reference<0.227480821.3738697732.157881>, parent_telemetry_span_context: #Reference<0.227480821.3738697733.138759>}}}, %{opts: %{websocket: [], http_1: [], http_2: []}, plug: {Phoenix.Endpoint.SyncCodeReloadPlug, {PetalProWeb.Endpoint, []}}, handler_module: Bandit.HTTP1.Handler, http_1_enabled: true, http_2_enabled: true, websocket_enabled: true, requests_processed: 2}})
    (stdlib 5.1.1) gen_server.erl:1077: :gen_server.try_handle_info/3
    (stdlib 5.1.1) gen_server.erl:1165: :gen_server.handle_msg/6
    (stdlib 5.1.1) proc_lib.erl:241: :proc_lib.init_p_do_apply/3
Last message: :clear_flash
State: {%ThousandIsland.Socket{socket: #Port<0.34>, transport_module: ThousandIsland.Transports.TCP, read_timeout: 60000, silent_terminate_on_error: false, span: %ThousandIsland.Telemetry{span_name: :connection, telemetry_span_context: #Reference<0.227480821.3738697732.157881>, start_time: -576460716151695028, start_metadata: %{remote_port: 40614, remote_address: {127, 0, 0, 1}, telemetry_span_context: #Reference<0.227480821.3738697732.157881>, parent_telemetry_span_context: #Reference<0.227480821.3738697733.138759>}}}, %{opts: %{websocket: [], http_1: [], http_2: []}, plug: {Phoenix.Endpoint.SyncCodeReloadPlug, {PetalProWeb.Endpoint, []}}, handler_module: Bandit.HTTP1.Handler, http_1_enabled: true, http_2_enabled: true, websocket_enabled: true, requests_processed: 2}}

I'm using live_admin 10.2 modified to support live_view 0.20.x.

Here is the description of the issue: https://github.com/mtrudel/bandit/issues/141

And proposed solution: https://github.com/mtrudel/bandit/issues/141#issuecomment-1537872411

Hope that is helpful.

tfwright commented 10 months ago

Should be fixed in latest main.

Rio517 commented 10 months ago

This is resolved for me.