Skip to content

Strange module exception error #740

Closed
@tommasop

Description

@tommasop

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
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

Status

No status

Relationships

None yet

Development

No branches or pull requests

Issue actions