SendGrid - NoMethodError (undefined method `[]' for nil:NilClass)

Did you ever figure this one out? I have the same error, on the same line of code:

I am not familiar with Ruby but it looks like it can parse the json just fiine up until trrying to parse the error code, Email::SMTP_STATUS_TRANSIENT_FAILURE points to:

I checked in Webhook.site what Sendgrid actually sends when I test the webhook and it looks like this for a bounce:

[
  {
    "email": "example@test.com",
    "timestamp": 1740136261,
    "smtp-id": "<14c5d75ce93.dfd.64b469@ismtpd-555>",
    "event": "bounce",
    "category": [
      "cat facts"
    ],
    "sg_event_id": "ovGQ2rRo8ytNezHPDq-7Ig==",
    "sg_message_id": "14c5d75ce93.dfd.64b469.filter0001.16648.5515E0B88.0",
    "reason": "500 unknown recipient",
    "status": "5.0.0"
  }
]

Seems like it should work!