getsentry / sentry-elixir

The official Elixir SDK for Sentry (sentry.io)
https://sentry.io
MIT License
627 stars 185 forks source link

`nil` crept up in exceptions #790

Closed BobbyMcWho closed 2 months ago

BobbyMcWho commented 2 months ago

Environment

sentry version: 10.7.1

Issue

I can't quite tell what is going wrong here or what is failing because of nil. We updated to 10.7.1 to fix some of them ( #779 ), but we're still seeing these after the upgrade for this error and a couple other ones as well. If I had to take a SWAG, it's because frames is nil, due to this PR: https://github.com/getsentry/sentry-elixir/pull/775

GenServer {Sentry.Transport.SenderRegistry, 2} terminating
** (Protocol.UndefinedError) protocol Enumerable not implemented for nil of type Atom. This protocol is implemented for the following type(s):
DBConnection.PrepareStream, DBConnection.Stream, Date.Range, 
Ecto.Adapters.SQL.Stream, File.Stream, Function, GenEvent.Stream, 
HashDict, HashSet, IO.Stream, Iteraptor.Array, Jason.OrderedObject, 
List, Map, MapSet, Phoenix.LiveView.LiveStream, Postgrex.Stream, 
Range, SFTPClient.Stream, Stream, Timex.Interval
    (elixir 1.17.2) lib/enum.ex:1: Enumerable.impl_for!/1
    (elixir 1.17.2) lib/enum.ex:166: Enumerable.reduce/3
    (elixir 1.17.2) lib/enum.ex:4423: Enum.map/2
    (sentry 10.7.1) lib/sentry/client.ex:292: anonymous fn/1 in Sentry.Client.render_exception/1
    (sentry 10.7.1) lib/sentry/client.ex:360: Sentry.Client.update_if_present/3
    (elixir 1.17.2) lib/enum.ex:1703: Enum."-map/2-lists^map/1-1-"/2
    (sentry 10.7.1) lib/sentry/client.ex:360: Sentry.Client.update_if_present/3
    (sentry 10.7.1) lib/sentry/client.ex:283: Sentry.Client.render_event/1
Last message: 
{:"$gen_cast",
 {:send, Sentry.HackneyClient,
  %Sentry.Event{
    event_id: "[redacted]",
    timestamp: "2024-09-10T20:51:41.598183",
    breadcrumbs: [],
    contexts: %{
      runtime: %{name: "elixir", version: "1.17.2 (compiled with Erlang/OTP 26)"},
      os: %{name: "linux", version: "4.14.318"}
    },
    dist: nil,
    environment: "prod",
    exception: [
      %Sentry.Interfaces.Exception{
        type: "Oban.TimeoutError",
        value: "Our.Oban.Worker timed out after 300000ms",
        module: nil,
        stacktrace: %Sentry.Interfaces.Stacktrace{frames: nil},
        mechanism: %Sentry.Interfaces.Exception.Mechanism{
          handled: true,
          data: nil,
          synthetic: nil,
          help_link: nil,
          meta: nil,
          type: "generic"
        }
      }
    ],
    extra: %{},
    fingerprint: ["{{ default }}"],
    level: :error,
    logger: nil,
    message: nil,
    modules: %{
      ...
    },
    platform: :elixir,
    release: "289157c",
    request: %Sentry.Interfaces.Request{
      method: nil,
      url: nil,
      query_string: nil,
      data: nil,
      cookies: nil,
      headers: nil,
      env: nil
    },
    sdk: %Sentry.Interfaces.SDK{name: "sentry-elixir", version: "10.7.1"},
    server_name: "1aa2b5ad38e6",
    tags: %{},
    transaction: nil,
    threads: nil,
    user: %{},
    integration_meta: %{},
    culprit: nil,
    attachments: [],
    source: nil,
    original_exception: %Oban.TimeoutError{
      message: "Our.Oban.Worker timed out after 300000ms",
      reason: :timeout
    }
  }}}
BobbyMcWho commented 2 months ago

Actually, this may be a duplicate of https://github.com/getsentry/sentry-elixir/issues/786

savhappy commented 2 months ago

@BobbyMcWho yep yep this is a duplicate of #786 and was fixed with PR #787

BobbyMcWho commented 2 months ago

Okay, thanks, is master sha safe to use, or should we wait for a release?

savhappy commented 2 months ago

Yes, you can try out the fix on the master branch. We'll do a release soon 💟

tomekowal commented 2 months ago

Hey! @savhappy I was wondering if you have a timeframe on the 10.7.2 release. I am asking because I am weighing my options between downgrading or waiting for the new release.

savhappy commented 2 months ago

@whatyouhide timeframe on this?

whatyouhide commented 2 months ago

@savhappy @tomekowal once https://github.com/getsentry/publish/issues/4371 is addressed. @savhappy you can ping Neel and Stephanie on Discord to speed things up if needed.