sentry-elixir icon indicating copy to clipboard operation
sentry-elixir copied to clipboard

Strange module exception error

Open tommasop opened this issue 1 year ago • 6 comments

Environment

elixir 1.14.5 OTP 25.3.2.12 phoenix 1.17.0

Steps to Reproduce

We have a plug exception defined like this:

  defmodule UnauthorizedRequestError do
    @moduledoc """
    Error raised when the Admin request is not authorized.
    """

    defexception message: "Admin request unauthorized", plug_status: 403
  end

And have filtered < 500 errors in before_send like this:

  def filter_non_500(%Sentry.Event{original_exception: exception} = event) do
    cond do
      Plug.Exception.status(exception) < 500 ->
        false

      # Fall back to the default event filter.
      Sentry.DefaultEventFilter.exclude_exception?(exception, event.source) ->
        false

      true ->
        event
    end
  end

Expected Result

I expect not to see any error logged in Sentry

Actual Result

We have many of these errors recorded:

JSON payload
{
  "event_id": "be16d92206304893b8b800779f7a8abe",
  "project": 4507390105813072,
  "release": null,
  "dist": null,
  "platform": "elixir",
  "message": "[[initial_call: {:cowboy_stream_h, :request_process, [:Argument__1, :Argument__2, :Argument__3]}, pid: #PID<0.9834.0>, registered_name: [], error_info: {:exit, {{{%IxiCenter.Plug.VerifyIxiDeviceRequest.UnauthorizedRequestError{message: \"iXi Device unauthorized\", plug_status: 403}, [{IxiCenter.Plug.VerifyIxiDeviceRequest, :verify_request!, 1, [file: 'lib/ixi_center/plug/verify_ixi_device_request.ex', line: 46, error_info: %{module: Exception}]}, {IxiCenter.Plug.VerifyIxiDeviceRequest, :call, 2, [file: 'lib/ixi_center/plug/verify_ixi_device_request.ex', line: 17]}, {IxiCenterWeb.Router, :api, 2, []}, {IxiCenterWeb.Router, :__pipe_through2__, 1, [file: 'lib/ixi_center_web/router.ex', line: 1]}, {Phoenix.Router, :__call__, 5, [file: 'lib/phoenix/router.ex', line: 416]}, {IxiCenterWeb.Endpoint, :plug_builder_call, 2, [file: 'lib/ixi_center_web/endpoint.ex', line: 1]}, {IxiCenterWeb.Endpoint, :\"call (overridable 3)\", 2, [file: 'lib/ixi_center_web/endpoint.ex', line: 1]}, {IxiCenterWeb.Endpoint, :call, 2, [file: 'lib/ixi_center_web/endpoint.ex', line: 1]}]}, {IxiCenterWeb.Endpoint, :call, [%Plug.Conn{adapter: {Plug.Cowboy.Conn, :...}, assigns: %{}, body_params: %Plug.Conn.Unfetched{aspect: :body_params}, cookies: %Plug.Conn.Unfetched{aspect: :cookies}, halted: false, host: \"ixicenterprd.magicmotorsport.com\", method: \"GET\", owner: #PID<0.9834.0>, params: %Plug.Conn.Unfetched{aspect: :params}, path_info: [\"api\", \"ixi_devices\", \"000000CC9F6003E7\", \"tuning_sessions\"], path_params: %{}, port: 80, private: %{}, query_params: %Plug.Conn.Unfetched{aspect: :query_params}, query_string: \"\", remote_ip: {0, 0, 0, 0, 0, 65535, 49320, 2704}, req_cookies: %Plug.Conn.Unfetched{aspect: :cookies}, req_headers: [{\"accept-encoding\", \"gzip, deflate, br\"}, {\"authorization\", \"Bearer eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJwcm9kdWN0cy5tYWdpY21vdG9yc3BvcnQuY29tIiwiZXhwIjoxNzE4ODMzMDc5LCJzbiI6IjAwMDAwMENDOUY2MDAzRTciLCJwaWQiOjI2NzA1MywidWlkIjo0MTU4NiwiYWlkIjoyLCJpcCI6IjE4NS4xNTcuMjMwLjEwOSIsImNycHQiOiJzZWVkIiwiZnAiOiIzTDN6SUVXNmN1NVVjY0ZMZXl2U0JNVWdtaE5CMndvTCJ9.oFgrfhTvDkjChNLTrjonwJ6lDjt3yPsLgdfviniujP4\"}, {\"content-type\", \"application/vnd.api+json\"}, {\"host\", \"ixicenterprd.magicmotorsport.com\"}, {\"postman-token\", \"13ebc2a3-3d6b-49fe-9058-04182b11c79a\"}, {\"user-agent\", \"PostmanRuntime/7.39.0\"}, {\"x-forwarded-for\", \"185.157.230.109, 192.168.10.104\"}, {\"x-forwarded-host\", \"ixicenterprd.magicmotorsport.com\"}, {\"x-forwarded-port\", \"443\"}, {\"x-forwarded-proto\", \"https\"}, {\"x-forwarded-server\", \"prd-client1\"}, {\"x-real-ip\", \"192.168.10.104\"}], request_path: \"/api/ixi_devices/000000CC9F6003E7/tuning_sessions\", resp_body: nil, resp_cookies: %{}, resp_headers: [{\"cache-control\", \"max-age=0, private, must-revalidate\"}], scheme: :http, script_name: [], secret_key_base: nil, state: :unset, status: nil}, []]}}, []}, []}, ancestors: [#PID<0.9833.0>, #PID<0.3276.0>, #PID<0.3275.0>, IxiCenterWeb.Endpoint, IxiCenter.Supervisor, #PID<0.3235.0>], message_queue_len: 0, messages: [], links: [#PID<0.9833.0>], dictionary: [rand_seed: {%{bits: 58, jump: #Function<3.34006561/1 in :rand.exsplus_jump>, next: #Function<0.34006561/1 in :rand.exsss_next>, type: :exsss, uniform: #Function<1.34006561/1 in :rand.exsss_uniform>, uniform_n: #Function<2.34006561/2 in :rand.exsss_uniform>}, [98198537292401754 | 12076600170047340]}, \"$logger_metadata$\": %{remote_ip: \"185.157.230.109\", request_id: \"F9qDZGoZxKBKhBMAAqrC\", sentry: %{request: %{cookies: %{}, data: %{}, env: %{\"REMOTE_ADDR\" => \"185.157.230.109\", \"REMOTE_PORT\" => 55654, \"REQUEST_ID\" => \"F9qDZGoA-Z1KhBMAAqqC\", \"SERVER_NAME\" => \"ixicenterprd.magicmotorsport.com\", \"SERVER_PORT\" => 80}, headers: %{\"accept-encoding\" => \"gzip, deflate, br\", \"content-type\" => \"application/vnd.api+json\", \"host\" => \"ixicenterprd.magicmotorsport.com\", \"postman-token\" => \"13ebc2a3-3d6b-49fe-9058-04182b11c79a\", \"user-agent\" => \"PostmanRuntime/7.39.0\", \"x-forwarded-for\" => \"185.157.230.109, 192.168.10.104\", \"x-forwarded-host\" => \"ixicenterprd.magicmotorsport.com\", \"x-forwarded-port\" => \"443\", \"x-forwarded-proto\" => \"https\", \"x-forwarded-server\" => \"prd-client1\", \"x-real-ip\" => \"192.168.10.104\"}, method: \"GET\", query_string: \"\", url: \"http://ixicenterprd.magicmotorsport.com/api/ixi_devices/000000CC9F6003E7/tuning_sessions\"}}}, sentry_last_event_id_and_source: {\"efc3cb2d59be45c9892df7719e2f931b\", :plug}], trap_exit: false, status: :running, heap_size: 4185, stack_size: 28, reductions: 57501], []]",
  "datetime": "2024-06-19T20:57:55+00:00",
  "tags": [
    [
      "browser",
      "PostmanRuntime 7.39.0"
    ],
    [
      "browser.name",
      "PostmanRuntime"
    ],
    [
      "environment",
      "production"
    ],
    [
      "level",
      "error"
    ],
    [
      "os",
      "linux 5.15.0"
    ],
    [
      "os.name",
      "linux"
    ],
    [
      "runtime",
      "elixir 1.14.5 (compiled with Erlang/OTP 25)"
    ],
    [
      "runtime.name",
      "elixir"
    ],
    [
      "user",
      "ip:185.157.230.109"
    ],
    [
      "server_name",
      "5337e1d718c4"
    ],
    [
      "url",
      "http://ixicenterprd.magicmotorsport.com/api/ixi_devices/000000CC9F6003E7/tuning_sessions"
    ]
  ],
  "_meta": {
    "request": {
      "headers": {
        "3": {
          "1": {
            "": {
              "rem": [
                [
                  "@password:filter",
                  "s",
                  0,
                  10
                ]
              ],
              "len": 36
            }
          }
        }
      }
    }
  },
  "_metrics": {
    "bytes.ingested.event": 8831,
    "bytes.stored.event": 9822
  },
  "contexts": {
    "browser": {
      "name": "PostmanRuntime",
      "version": "7.39.0",
      "type": "browser"
    },
    "os": {
      "name": "linux",
      "version": "5.15.0",
      "type": "os"
    },
    "runtime": {
      "name": "elixir",
      "version": "1.14.5 (compiled with Erlang/OTP 25)",
      "type": "runtime"
    }
  },
  "culprit": "http://ixicenterprd.magicmotorsport.com/api/ixi_devices/000000CC9F6003E7/tuning_sessions",
  "environment": "production",
  "extra": {
    "logger_level": "error",
    "logger_metadata": {
      "file": "proc_lib.erl",
      "line": 539
    }
  },
  "fingerprint": [
    "{{ default }}"
  ],
  "grouping_config": {
    "enhancements": "KLUv_SAYwQAAkwKRs25ld3N0eWxlOjIwMjMtMDEtMTGQ",
    "id": "newstyle:2023-01-11"
  },
  "hashes": [
    "c44a3143143c1e866f67922fab5a5364"
  ],
  "ingest_path": [
    {
      "version": "24.5.1",
      "public_key": "7pLPdtCQBMLtodCJ3yOtI9MDBUWfX0k5eDa4ZP4CX6A"
    }
  ],
  "key_id": "32997",
  "level": "error",
  "logentry": {
    "formatted": "[[initial_call: {:cowboy_stream_h, :request_process, [:Argument__1, :Argument__2, :Argument__3]}, pid: #PID<0.9834.0>, registered_name: [], error_info: {:exit, {{{%IxiCenter.Plug.VerifyIxiDeviceRequest.UnauthorizedRequestError{message: \"iXi Device unauthorized\", plug_status: 403}, [{IxiCenter.Plug.VerifyIxiDeviceRequest, :verify_request!, 1, [file: 'lib/ixi_center/plug/verify_ixi_device_request.ex', line: 46, error_info: %{module: Exception}]}, {IxiCenter.Plug.VerifyIxiDeviceRequest, :call, 2, [file: 'lib/ixi_center/plug/verify_ixi_device_request.ex', line: 17]}, {IxiCenterWeb.Router, :api, 2, []}, {IxiCenterWeb.Router, :__pipe_through2__, 1, [file: 'lib/ixi_center_web/router.ex', line: 1]}, {Phoenix.Router, :__call__, 5, [file: 'lib/phoenix/router.ex', line: 416]}, {IxiCenterWeb.Endpoint, :plug_builder_call, 2, [file: 'lib/ixi_center_web/endpoint.ex', line: 1]}, {IxiCenterWeb.Endpoint, :\"call (overridable 3)\", 2, [file: 'lib/ixi_center_web/endpoint.ex', line: 1]}, {IxiCenterWeb.Endpoint, :call, 2, [file: 'lib/ixi_center_web/endpoint.ex', line: 1]}]}, {IxiCenterWeb.Endpoint, :call, [%Plug.Conn{adapter: {Plug.Cowboy.Conn, :...}, assigns: %{}, body_params: %Plug.Conn.Unfetched{aspect: :body_params}, cookies: %Plug.Conn.Unfetched{aspect: :cookies}, halted: false, host: \"ixicenterprd.magicmotorsport.com\", method: \"GET\", owner: #PID<0.9834.0>, params: %Plug.Conn.Unfetched{aspect: :params}, path_info: [\"api\", \"ixi_devices\", \"000000CC9F6003E7\", \"tuning_sessions\"], path_params: %{}, port: 80, private: %{}, query_params: %Plug.Conn.Unfetched{aspect: :query_params}, query_string: \"\", remote_ip: {0, 0, 0, 0, 0, 65535, 49320, 2704}, req_cookies: %Plug.Conn.Unfetched{aspect: :cookies}, req_headers: [{\"accept-encoding\", \"gzip, deflate, br\"}, {\"authorization\", \"Bearer eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJwcm9kdWN0cy5tYWdpY21vdG9yc3BvcnQuY29tIiwiZXhwIjoxNzE4ODMzMDc5LCJzbiI6IjAwMDAwMENDOUY2MDAzRTciLCJwaWQiOjI2NzA1MywidWlkIjo0MTU4NiwiYWlkIjoyLCJpcCI6IjE4NS4xNTcuMjMwLjEwOSIsImNycHQiOiJzZWVkIiwiZnAiOiIzTDN6SUVXNmN1NVVjY0ZMZXl2U0JNVWdtaE5CMndvTCJ9.oFgrfhTvDkjChNLTrjonwJ6lDjt3yPsLgdfviniujP4\"}, {\"content-type\", \"application/vnd.api+json\"}, {\"host\", \"ixicenterprd.magicmotorsport.com\"}, {\"postman-token\", \"13ebc2a3-3d6b-49fe-9058-04182b11c79a\"}, {\"user-agent\", \"PostmanRuntime/7.39.0\"}, {\"x-forwarded-for\", \"185.157.230.109, 192.168.10.104\"}, {\"x-forwarded-host\", \"ixicenterprd.magicmotorsport.com\"}, {\"x-forwarded-port\", \"443\"}, {\"x-forwarded-proto\", \"https\"}, {\"x-forwarded-server\", \"prd-client1\"}, {\"x-real-ip\", \"192.168.10.104\"}], request_path: \"/api/ixi_devices/000000CC9F6003E7/tuning_sessions\", resp_body: nil, resp_cookies: %{}, resp_headers: [{\"cache-control\", \"max-age=0, private, must-revalidate\"}], scheme: :http, script_name: [], secret_key_base: nil, state: :unset, status: nil}, []]}}, []}, []}, ancestors: [#PID<0.9833.0>, #PID<0.3276.0>, #PID<0.3275.0>, IxiCenterWeb.Endpoint, IxiCenter.Supervisor, #PID<0.3235.0>], message_queue_len: 0, messages: [], links: [#PID<0.9833.0>], dictionary: [rand_seed: {%{bits: 58, jump: #Function<3.34006561/1 in :rand.exsplus_jump>, next: #Function<0.34006561/1 in :rand.exsss_next>, type: :exsss, uniform: #Function<1.34006561/1 in :rand.exsss_uniform>, uniform_n: #Function<2.34006561/2 in :rand.exsss_uniform>}, [98198537292401754 | 12076600170047340]}, \"$logger_metadata$\": %{remote_ip: \"185.157.230.109\", request_id: \"F9qDZGoZxKBKhBMAAqrC\", sentry: %{request: %{cookies: %{}, data: %{}, env: %{\"REMOTE_ADDR\" => \"185.157.230.109\", \"REMOTE_PORT\" => 55654, \"REQUEST_ID\" => \"F9qDZGoA-Z1KhBMAAqqC\", \"SERVER_NAME\" => \"ixicenterprd.magicmotorsport.com\", \"SERVER_PORT\" => 80}, headers: %{\"accept-encoding\" => \"gzip, deflate, br\", \"content-type\" => \"application/vnd.api+json\", \"host\" => \"ixicenterprd.magicmotorsport.com\", \"postman-token\" => \"13ebc2a3-3d6b-49fe-9058-04182b11c79a\", \"user-agent\" => \"PostmanRuntime/7.39.0\", \"x-forwarded-for\" => \"185.157.230.109, 192.168.10.104\", \"x-forwarded-host\" => \"ixicenterprd.magicmotorsport.com\", \"x-forwarded-port\" => \"443\", \"x-forwarded-proto\" => \"https\", \"x-forwarded-server\" => \"prd-client1\", \"x-real-ip\" => \"192.168.10.104\"}, method: \"GET\", query_string: \"\", url: \"http://ixicenterprd.magicmotorsport.com/api/ixi_devices/000000CC9F6003E7/tuning_sessions\"}}}, sentry_last_event_id_and_source: {\"efc3cb2d59be45c9892df7719e2f931b\", :plug}], trap_exit: false, status: :running, heap_size: 4185, stack_size: 28, reductions: 57501], []]"
  },
  "logger": "",
  "metadata": {
    "title": "[[initial_call: {:cowboy_stream_h, :request_process, [:Argument__1, :Argument__2, :Argument__3]},..."
  },
  "modules": {
    "acceptor_pool": "1.0.0",
    "argon2_elixir": "3.0.0",
    "asn1": "5.0.21.1",
    "aws": "0.13.3",
    "aws_signature": "0.3.1",
    "castore": "0.1.22",
    "certifi": "2.12.0",
    "chatterbox": "0.13.0",
    "cldr_utils": "2.24.1",
    "combine": "0.10.0",
    "comeonin": "5.3.3",
    "compiler": "8.2.6.4",
    "connection": "1.1.0",
    "cors_plug": "3.0.3",
    "cowboy": "2.12.0",
    "cowboy_telemetry": "0.4.0",
    "cowlib": "2.13.0",
    "crypto": "5.1.4.3",
    "csv": "3.2.1",
    "ctx": "0.6.0",
    "db_connection": "2.6.0",
    "decimal": "2.1.1",
    "digital_token": "0.6.0",
    "dotenv_parser": "2.0.0",
    "ecto": "3.9.6",
    "ecto_sql": "3.9.1",
    "eex": "1.14.5",
    "elixir": "1.14.5",
    "eqrcode": "0.1.10",
    "ex_cldr": "2.37.2",
    "ex_cldr_currencies": "2.15.0",
    "ex_cldr_numbers": "2.32.1",
    "ex_money": "5.15.0",
    "ex_unit": "1.14.5",
    "expo": "0.4.1",
    "file_info": "0.0.4",
    "gettext": "0.23.1",
    "gproc": "0.8.0",
    "grpcbox": "0.16.0",
    "hackney": "1.18.2",
    "heroicons": "0.5.2",
    "hpack": "0.2.3",
    "idna": "6.1.1",
    "inets": "8.3.1.3",
    "inspecto": "0.3.1",
    "ixi_center": "0.1.0",
    "jason": "1.4.1",
    "jsonapi": "1.6.3",
    "kernel": "8.5.4.3",
    "logger": "1.14.5",
    "logger_json": "5.1.2",
    "metrics": "1.0.1",
    "mime": "2.0.5",
    "mimerl": "1.2.0",
    "mimetype_parser": "0.1.3",
    "nimble_options": "1.0.2",
    "nimble_ownership": "0.3.1",
    "nimble_parsec": "1.3.1",
    "nimble_totp": "0.1.3",
    "open_api_spex": "3.18.2",
    "opentelemetry": "1.3.0",
    "opentelemetry_api": "1.2.1",
    "opentelemetry_cowboy": "0.2.1",
    "opentelemetry_ecto": "1.1.1",
    "opentelemetry_exporter": "1.6.0",
    "opentelemetry_phoenix": "1.1.1",
    "opentelemetry_process_propagator": "0.2.2",
    "opentelemetry_semantic_conventions": "0.2.0",
    "opentelemetry_telemetry": "1.0.0",
    "parse_trans": "3.4.1",
    "phoenix": "1.7.0",
    "phoenix_ecto": "4.4.0",
    "phoenix_html": "3.3.0",
    "phoenix_live_dashboard": "0.7.2",
    "phoenix_live_view": "0.18.3",
    "phoenix_pubsub": "2.1.1",
    "phoenix_template": "1.0.1",
    "phoenix_view": "2.0.2",
    "plug": "1.16.0",
    "plug_cowboy": "2.6.0",
    "plug_crypto": "1.2.5",
    "postgrex": "0.16.5",
    "public_key": "1.13.3.2",
    "ranch": "1.8.0",
    "remote_ip": "1.2.0",
    "runtime_tools": "1.19",
    "sasl": "4.2",
    "sentry": "10.2.1",
    "ssl": "10.9.1.4",
    "ssl_verify_fun": "1.1.7",
    "stdlib": "4.3.1.4",
    "swoosh": "1.8.3",
    "syntax_tools": "3.0.1",
    "telemetry": "1.2.1",
    "telemetry_metrics": "0.6.1",
    "telemetry_registry": "0.3.1",
    "tesla": "1.7.0",
    "tesla_request_id": "0.2.0",
    "tls_certificate_check": "1.19.0",
    "unicode_util_compat": "0.7.0",
    "websock": "0.4.3",
    "websock_adapter": "0.4.5",
    "xmerl": "1.3.31.1"
  },
  "nodestore_insert": 1718830677.3961,
  "received": 1718830675.298389,
  "request": {
    "url": "http://ixicenterprd.magicmotorsport.com/api/ixi_devices/000000CC9F6003E7/tuning_sessions",
    "method": "GET",
    "data": {},
    "headers": [
      [
        "Accept-Encoding",
        "gzip, deflate, br"
      ],
      [
        "Content-Type",
        "application/vnd.api+json"
      ],
      [
        "Host",
        "ixicenterprd.magicmotorsport.com"
      ],
      [
        "Postman-Token",
        "[Filtered]"
      ],
      [
        "User-Agent",
        "PostmanRuntime/7.39.0"
      ],
      [
        "X-Forwarded-For",
        "185.157.230.109, 192.168.10.104"
      ],
      [
        "X-Forwarded-Host",
        "ixicenterprd.magicmotorsport.com"
      ],
      [
        "X-Forwarded-Port",
        "443"
      ],
      [
        "X-Forwarded-Proto",
        "https"
      ],
      [
        "X-Forwarded-Server",
        "prd-client1"
      ],
      [
        "X-Real-Ip",
        "192.168.10.104"
      ]
    ],
    "env": {
      "REMOTE_ADDR": "185.157.230.109",
      "REMOTE_PORT": 55654,
      "REQUEST_ID": "F9qDZGoA-Z1KhBMAAqqC",
      "SERVER_NAME": "ixicenterprd.magicmotorsport.com",
      "SERVER_PORT": 80
    },
    "inferred_content_type": "application/vnd.api+json"
  },
  "sdk": {
    "name": "sentry-elixir",
    "version": "10.2.1"
  },
  "timestamp": 1718830675.168346,
  "title": "[[initial_call: {:cowboy_stream_h, :request_process, [:Argument__1, :Argument__2, :Argument__3]},...",
  "type": "default",
  "user": {
    "ip_address": "185.157.230.109",
    "geo": {
      "country_code": "IT",
      "city": "Partinico",
      "subdivision": "Sicily",
      "region": "Italy"
    },
    "sentry_user": "ip:185.157.230.109"
  },
  "version": "5",
  "location": null
}

tommasop avatar Jun 20 '24 21:06 tommasop

I cleaned up the error, it's here in case it makes it easier to debug:

[
  [
    initial_call:
      {:cowboy_stream_h, :request_process, [:Argument__1, :Argument__2, :Argument__3]},
    pid: %PID{},
    registered_name: [],
    error_info:
      {:exit,
       {{{%IxiCenter.Plug.VerifyIxiDeviceRequest.UnauthorizedRequestError{
            message: "iXi Device unauthorized",
            plug_status: 403
          },
          [
            {IxiCenter.Plug.VerifyIxiDeviceRequest, :verify_request!, 1,
             [
               file: ~c"lib/ixi_center/plug/verify_ixi_device_request.ex",
               line: 46,
               error_info: %{module: Exception}
             ]},
            {IxiCenter.Plug.VerifyIxiDeviceRequest, :call, 2,
             [file: ~c"lib/ixi_center/plug/verify_ixi_device_request.ex", line: 17]},
            {IxiCenterWeb.Router, :api, 2, []},
            {IxiCenterWeb.Router, :__pipe_through2__, 1,
             [file: ~c"lib/ixi_center_web/router.ex", line: 1]},
            {Phoenix.Router, :__call__, 5, [file: ~c"lib/phoenix/router.ex", line: 416]},
            {IxiCenterWeb.Endpoint, :plug_builder_call, 2,
             [file: ~c"lib/ixi_center_web/endpoint.ex", line: 1]},
            {IxiCenterWeb.Endpoint, :"call (overridable 3)", 2,
             [file: ~c"lib/ixi_center_web/endpoint.ex", line: 1]},
            {IxiCenterWeb.Endpoint, :call, 2, [file: ~c"lib/ixi_center_web/endpoint.ex", line: 1]}
          ]},
         {IxiCenterWeb.Endpoint, :call,
          [
            %Plug.Conn{
              adapter: {Plug.Cowboy.Conn, :...},
              assigns: %{},
              body_params: %Plug.Conn.Unfetched{aspect: :body_params},
              cookies: %Plug.Conn.Unfetched{aspect: :cookies},
              halted: false,
              host: "ixicenterprd.magicmotorsport.com",
              method: "GET",
              owner: %PID{},
              params: %Plug.Conn.Unfetched{aspect: :params},
              path_info: ["api", "ixi_devices", "000000CC9F6003E7", "tuning_sessions"],
              path_params: %{},
              port: 80,
              private: %{},
              query_params: %Plug.Conn.Unfetched{aspect: :query_params},
              query_string: "",
              remote_ip: {0, 0, 0, 0, 0, 65535, 49320, 2704},
              req_cookies: %Plug.Conn.Unfetched{aspect: :cookies},
              req_headers: [
                {"accept-encoding", "gzip, deflate, br"},
                {"authorization",
                 "Bearer eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJwcm9kdWN0cy5tYWdpY21vdG9yc3BvcnQuY29tIiwiZXhwIjoxNzE4ODMzMDc5LCJzbiI6IjAwMDAwMENDOUY2MDAzRTciLCJwaWQiOjI2NzA1MywidWlkIjo0MTU4NiwiYWlkIjoyLCJpcCI6IjE4NS4xNTcuMjMwLjEwOSIsImNycHQiOiJzZWVkIiwiZnAiOiIzTDN6SUVXNmN1NVVjY0ZMZXl2U0JNVWdtaE5CMndvTCJ9.oFgrfhTvDkjChNLTrjonwJ6lDjt3yPsLgdfviniujP4"},
                {"content-type", "application/vnd.api+json"},
                {"host", "ixicenterprd.magicmotorsport.com"},
                {"postman-token", "13ebc2a3-3d6b-49fe-9058-04182b11c79a"},
                {"user-agent", "PostmanRuntime/7.39.0"},
                {"x-forwarded-for", "185.157.230.109, 192.168.10.104"},
                {"x-forwarded-host", "ixicenterprd.magicmotorsport.com"},
                {"x-forwarded-port", "443"},
                {"x-forwarded-proto", "https"},
                {"x-forwarded-server", "prd-client1"},
                {"x-real-ip", "192.168.10.104"}
              ],
              request_path: "/api/ixi_devices/000000CC9F6003E7/tuning_sessions",
              resp_body: nil,
              resp_cookies: %{},
              resp_headers: [{"cache-control", "max-age=0, private, must-revalidate"}],
              scheme: :http,
              script_name: [],
              secret_key_base: nil,
              state: :unset,
              status: nil
            },
            []
          ]}}, []}, []},
    ancestors: [%PID{}, %PID{}, %PID{}, IxiCenterWeb.Endpoint, IxiCenter.Supervisor, %PID{}],
    message_queue_len: 0,
    messages: [],
    links: [%PID{}],
    dictionary: [
      rand_seed:
        {%{bits: 58, jump: :fun, next: :fun, type: :exsss, uniform: :fun, uniform_n: :fun},
         [98_198_537_292_401_754 | 12_076_600_170_047_340]},
      "$logger_metadata$": %{
        remote_ip: "185.157.230.109",
        request_id: "F9qDZGoZxKBKhBMAAqrC",
        sentry: %{
          request: %{
            cookies: %{},
            data: %{},
            env: %{
              "REMOTE_ADDR" => "185.157.230.109",
              "REMOTE_PORT" => 55654,
              "REQUEST_ID" => "F9qDZGoA-Z1KhBMAAqqC",
              "SERVER_NAME" => "ixicenterprd.magicmotorsport.com",
              "SERVER_PORT" => 80
            },
            headers: %{
              "accept-encoding" => "gzip, deflate, br",
              "content-type" => "application/vnd.api+json",
              "host" => "ixicenterprd.magicmotorsport.com",
              "postman-token" => "13ebc2a3-3d6b-49fe-9058-04182b11c79a",
              "user-agent" => "PostmanRuntime/7.39.0",
              "x-forwarded-for" => "185.157.230.109, 192.168.10.104",
              "x-forwarded-host" => "ixicenterprd.magicmotorsport.com",
              "x-forwarded-port" => "443",
              "x-forwarded-proto" => "https",
              "x-forwarded-server" => "prd-client1",
              "x-real-ip" => "192.168.10.104"
            },
            method: "GET",
            query_string: "",
            url:
              "http://ixicenterprd.magicmotorsport.com/api/ixi_devices/000000CC9F6003E7/tuning_sessions"
          }
        }
      },
      sentry_last_event_id_and_source: {"efc3cb2d59be45c9892df7719e2f931b", :plug}
    ],
    trap_exit: false,
    status: :running,
    heap_size: 4185,
    stack_size: 28,
    reductions: 57501
  ],
  []
]

whatyouhide avatar Jun 28 '24 11:06 whatyouhide

I’m a little stumped by this to be honest. I don't see cowboy logging anything on its own in cowboy_stream_h.erl, which could explain this log being reported.

In any case, could you share your Sentry config in case it might help debug this? Also, just putting it out there, do you have a way to consistently reproduce this?

cc @ninenines in case this is obvious to you šŸ˜„

whatyouhide avatar Jun 28 '24 16:06 whatyouhide

@whatyouhide this is the runtime configuration we have for sentry:

config :sentry,
    dsn:
      "https://720a295a41be850479e6fc8eed51f841@o4507304654995456.ingest.de.sentry.io/4507390105813072",
    environment_name: get_env("DEPLOYMENT_ENV"),
    enable_source_code_context: true,
    root_source_code_paths: [File.cwd!()],
    before_send: {IxiCenter.SentryEventFilter, :filter_non_500}

I will try to setup a minimal environment to reproduce this.

In the meantime is it possibile to filter these errors out in order to:

  1. Reduce noise
  2. Avoid to get over threshold cap

Thanks a lot

tommasop avatar Jul 01 '24 09:07 tommasop

You can filter them out yourself in your before_send, by matching on parts of the message. I don't think it's a good idea to filter them out in Sentry before figuring out what is actually happening here šŸ™ƒ

whatyouhide avatar Jul 01 '24 09:07 whatyouhide

@whatyouhide here is a repository that triggers the error:

https://github.com/tommasop/elixir-boilerplate

to make the error appear:

curl -H "Authorization: Bearer 123456578" https://yourappdomainname.com/api/login

tommasop avatar Jul 05 '24 22:07 tommasop

@whatyouhide we are migrating to OTP 27.0 and elixir 1.17.2 we have the dev env already migrated and the error is not present any longer.

It is still present in prod with the old erlang/elixir versions.

tommasop avatar Jul 12 '24 11:07 tommasop

For others on this, I was able to reproduce this by:

  1. Cloning https://github.com/tommasop/elixir-boilerplate
  2. Move the config :sentry from config/runtime.exs to config/config.exs
  3. Put in your actual Sentry DSN
  4. cp .env.template .env (needs direnv or something)
  5. mix do deps.get + phx.server
  6. curl -H 'Authorization: Bearer 12341234' http://localhost:4000/api/login

Looking into this now.

whatyouhide avatar Oct 30 '24 08:10 whatyouhide

I get this error with /api/login because AppName.VerifyAdminRequest checks for a bad function clause (path_info: ["api/login" | _]).

Image

Fixing it to be path_info: ["api", "login" | _] raises the UnauthorizedRequestError we're trying to debug.

whatyouhide avatar Oct 30 '24 08:10 whatyouhide