Skip to content

Error in LiveView process #663

@barkerja

Description

@barkerja

Environment

10.0.3

Steps to Reproduce

Raise any exception inside a LiveView process

Expected Result

Raised exception is reported to Sentry

Actual Result

When an exception is thrown inside a LiveView process, the following error is raised:

** (exit) an exception was raised:
    ** (ArgumentError) unknown field for the request interface: :id
        (sentry 10.0.3) lib/sentry/event.ex:326: anonymous fn/2 in Sentry.Event.coerce_request/1
        (stdlib 3.17.1) maps.erl:410: :maps.fold_1/3
        (sentry 10.0.3) lib/sentry/event.ex:272: Sentry.Event.create_event/1
        (sentry 10.0.3) lib/sentry.ex:235: Sentry.capture_exception/2
        (sentry 10.0.3) lib/sentry/plug_capture.ex:140: Sentry.PlugCapture.__capture_exception__/3
        (voyd 37.16.22) lib/voyd_web/endpoint.ex:1: VoydWeb.Endpoint."call (overridable 3)"/2
        (voyd 37.16.22) lib/plug/debugger.ex:136: VoydWeb.Endpoint."call (overridable 4)"/2
        (voyd 37.16.22) lib/voyd_web/endpoint.ex:1: VoydWeb.Endpoint.call/2
        (phoenix 1.7.9) lib/phoenix/endpoint/sync_code_reload_plug.ex:22: Phoenix.Endpoint.SyncCodeReloadPlug.do_call/4
        (plug_cowboy 2.6.1) lib/plug/cowboy/handler.ex:11: Plug.Cowboy.Handler.init/2
        (cowboy 2.10.0) /voyd/deps/cowboy/src/cowboy_handler.erl:37: :cowboy_handler.execute/2
        (cowboy 2.10.0) /voyd/deps/cowboy/src/cowboy_stream_h.erl:306: :cowboy_stream_h.execute/3
        (cowboy 2.10.0) /voyd/deps/cowboy/src/cowboy_stream_h.erl:295: :cowboy_stream_h.request_process/3
        (stdlib 3.17.1) proc_lib.erl:226: :proc_lib.init_p_do_apply/3

If I inspect the request that is given to Sentry.Event.coerce_request/1 using break! Sentry.Event.coerce_request/1, its shape is:

pry(1)> request
%{
  cookies: %{},
  data: %{},
  env: %{
    "REMOTE_ADDR" => "192.168.228.1",
    "REMOTE_PORT" => 53624,
    "REQUEST_ID" => nil,
    "SERVER_NAME" => "voyd.dev.c-spot.run",
    "SERVER_PORT" => 443
  },
  headers: %{
    "accept" => "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
    "accept-encoding" => "gzip, deflate, br",
    "accept-language" => "en-US,en;q=0.9",
    "cache-control" => "max-age=0",
    "host" => "voyd.dev.c-spot.run",
    "referer" => "https://voyd.dev.c-spot.run/home",
    "sec-fetch-dest" => "document",
    "sec-fetch-mode" => "navigate",
    "sec-fetch-site" => "same-origin",
    "user-agent" => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2 Safari/605.1.15",
    "x-forwarded-for" => "192.168.228.1",
    "x-forwarded-host" => "voyd.dev.c-spot.run",
    "x-forwarded-port" => "443",
    "x-forwarded-proto" => "https",
    "x-forwarded-server" => "28dad0eabcba",
    "x-real-ip" => "192.168.228.1"
  },
  id: "phx-F54bgclcZGpMC0LC",
  method: "GET",
  query_string: "",
  url: "https://voyd.dev.c-spot.run/home"
}

The given id which is a phx-, appears to only occur in LiveView requests. id does not exist for normal plug requests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions