firezone / firezone

Enterprise-ready zero-trust access platform built on WireGuard®.
https://www.firezone.dev
Apache License 2.0
6.87k stars 286 forks source link

`no match of right hand side value: {:error, {:unauthorized, [reason: :subject_expired]}}` #7235

Open jamilbk opened 3 weeks ago

jamilbk commented 3 weeks ago

This seems to happen if the user's session expires while in the admin portal in the middle of performing an operation. I thought the LiveView would disconnect us here and force a page reload, but perhaps there is a timing issue here, the LiveView isn't connected in these cases, or perhaps the subject expired via some other means.

cc @AndrewDryga @bmanifold

{
  "insertId": "1k3w3j9few2mhe",
  "jsonPayload": {
    "cos.googleapis.com/container_name": "klt-web-bwzi",
    "time": "2024-10-31T17:06:47.475Z",
    "stack_trace": "** (MatchError) no match of right hand side value: {:error, {:unauthorized, [reason: :subject_expired]}}\n    (web 0.1.0+deadbeef) lib/web/live/clients/show.ex:479:in `Web.Clients.Show.handle_event/3'\n    (phoenix_live_view 1.0.0-rc.6) lib/phoenix_live_view/channel.ex:508:in `anonymous fn/3 in Phoenix.LiveView.Channel.view_handle_event/3'\n    (telemetry 1.3.0) /app/deps/telemetry/src/telemetry.erl:324:in `:telemetry.span/3'\n    (phoenix_live_view 1.0.0-rc.6) lib/phoenix_live_view/channel.ex:260:in `Phoenix.LiveView.Channel.handle_info/2'\n    (stdlib 6.0.1) gen_server.erl:2173:in `:gen_server.try_handle_info/3'\n    (stdlib 6.0.1) gen_server.erl:2261:in `:gen_server.handle_msg/6'\n    (stdlib 6.0.1) proc_lib.erl:329:in `:proc_lib.init_p_do_apply/3'\n",
    "context": {
      "reportLocation": {
        "functionName": "gen_server.error_info/8",
        "filePath": "gen_server.erl",
        "lineNumber": 2474
      }
    },
    "cos.googleapis.com/container_id": "9789a79002505a65f114d601dfaaac18271239a53379c9b21cb247db099b5c18",
    "message": "no match of right hand side value: {:error, {:unauthorized, [reason: :subject_expired]}}",
    "cos.googleapis.com/stream": "stdout",
    "error_logger": {
      "tag": "error",
      "report_cb": "&:gen_server.format_log/1"
    },
    "domain": [
      "otp"
    ],
    "serviceContext": {
      "service": "web@web-07t6.us-east1-d.c.firezone-prod.internal"
    },
    "@type": "type.googleapis.com/google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent",
    "logging.googleapis.com/spanId": "c8a25c8c90dfe743"
  },
  "resource": {
    "type": "gce_instance",
    "labels": {
      "zone": "us-east1-d",
      "instance_id": "6684212053457774289",
      "project_id": "firezone-prod"
    }
  },
  "timestamp": "2024-10-31T17:06:47.489969280Z",
  "severity": "ERROR",
  "logName": "projects/firezone-prod/logs/cos_containers",
  "operation": {
    "producer": "#PID<0.1060987.0>"
  },
  "trace": "projects/firezone-prod/traces/4694e1770e3d415077453ec8f46c54a8",
  "sourceLocation": {
    "file": "gen_server.erl",
    "line": "2474",
    "function": "gen_server.error_info/8"
  },
  "receiveTimestamp": "2024-10-31T17:06:47.756225304Z",
  "errorGroups": [
    {
      "id": "CM-t_q2WjJOLiAE"
    }
  ]
}
jamilbk commented 3 weeks ago

Related: #6789