Skip to content

RewriteFrames doesn't work if event contains exception and stacktrace #3652

@cawa-93

Description

@cawa-93

I encountered a problem through which some events did not run RewriteFrames integrations. After a long debugging, I found the reason:

if (event.exception && Array.isArray(event.exception.values)) {
return this._processExceptionsEvent(event);
}
if (event.stacktrace) {
return this._processStacktraceEvent(event);
}

My original problem event (private data was removed)
{
  "exception": {
    "values": [
      {
        "type": "Error",
        "value": "Non-Error exception captured with keys: code, message",
        "mechanism": {
          "synthetic": true,
          "handled": true,
          "type": "generic"
        }
      }
    ]
  },
  "extra": {
    "__serialized__": {
      "code": 403,
      "message": "You should login first."
    }
  },
  "stacktrace": {
    "frames": [
      {
        "colno": 58696,
        "filename": "anime-lib://./vendor.61c073fd.js",
        "function": "r",
        "in_app": true,
        "lineno": 49
      },
      {
        "colno": 8682,
        "filename": "anime-lib://./vendor.61c073fd.js",
        "function": "?",
        "in_app": true,
        "lineno": 63
      },
      {
        "colno": 27939,
        "filename": "anime-lib://./vendor.61c073fd.js",
        "function": "e.withScope",
        "in_app": true,
        "lineno": 49
      },
      {
        "colno": 8731,
        "filename": "anime-lib://./vendor.61c073fd.js",
        "function": "?",
        "in_app": true,
        "lineno": 63
      }
    ]
  },
  "level": "error",
  "event_id": "353ce3bab8f5465e8b4e6160e5fb8efe",
  "platform": "javascript",
  "timestamp": 1622881474.332,
  "environment": "production",
  "release": "v21.6.5-504",
  "sdk": {
    "integrations": [
      "InboundFilters",
      "FunctionToString",
      "TryCatch",
      "Breadcrumbs",
      "GlobalHandlers",
      "LinkedErrors",
      "UserAgent",
      "RewriteFrames",
      "Vue"
    ],
    "name": "sentry.javascript.browser",
    "version": "6.5.1",
    "packages": [
      {
        "name": "npm:@sentry/browser",
        "version": "6.5.1"
      }
    ]
  },
  "contexts": {
    "vue": {
      "componentName": "anonymous component",
      "lifecycleHook": 3
    }
  },
  "breadcrumbs": [
    {
      "timestamp": 1622881469.385,
      "category": "navigation",
      "data": {
        "from": "/",
        "to": "/"
      }
    },
    {
      "timestamp": 1622881469.454,
      "category": "fetch",
      "data": {
        "method": "GET",
        "url": "https://smotret-anime.online/api/series?...",
        "status_code": 200
      },
      "type": "http"
    },
    {
      "timestamp": 1622881469.455,
      "category": "fetch",
      "data": {
        "method": "GET",
        "url": "https://smotret-anime.online/api/series?...",
        "status_code": 200
      },
      "type": "http"
    },
    {
      "timestamp": 1622881469.456,
      "category": "fetch",
      "data": {
        "method": "GET",
        "url": "https://smotret-anime.online/api/series?...",
        "status_code": 200
      },
      "type": "http"
    },
    {
      "timestamp": 1622881469.456,
      "category": "fetch",
      "data": {
        "method": "GET",
        "url": "https://smotret-anime.online/api/series?...",
        "status_code": 200
      },
      "type": "http"
    },
    {
      "timestamp": 1622881469.457,
      "category": "fetch",
      "data": {
        "method": "GET",
        "url": "https://smotret-anime.online/api/series?...",
        "status_code": 200
      },
      "type": "http"
    },
    {
      "timestamp": 1622881469.54,
      "category": "fetch",
      "data": {
        "method": "POST",
        "url": "https://google-analytics.com/collect",
        "status_code": 200
      },
      "type": "http"
    },
    {
      "timestamp": 1622881473.008,
      "category": "ui.click",
      "message": "div.input-group > input#search-field.form-control[type=\"url\"]"
    },
    {
      "timestamp": 1622881474.201,
      "category": "navigation",
      "data": {
        "from": "/",
        "to": "/"
      }
    },
    {
      "timestamp": 1622881474.201,
      "category": "navigation",
      "data": {
        "from": "/",
        "to": "/watch/40748/"
      }
    },
    {
      "timestamp": 1622881474.216,
      "category": "fetch",
      "data": {
        "method": "GET",
        "url": "https://smotret-anime.online/api/series?...",
        "status_code": 200
      },
      "type": "http"
    },
    {
      "timestamp": 1622881474.219,
      "category": "navigation",
      "data": {
        "from": "/watch/40748/",
        "to": "/watch/40748/16/#t=0"
      }
    },
    {
      "timestamp": 1622881474.226,
      "category": "fetch",
      "data": {
        "method": "GET",
        "url": "https://smotret-anime.online/api/series?...",
        "status_code": 200
      },
      "type": "http"
    },
    {
      "timestamp": 1622881474.231,
      "category": "fetch",
      "data": {
        "method": "GET",
        "url": "https://smotret-anime.online/api/translations?...",
        "status_code": 200
      },
      "type": "http"
    },
    {
      "timestamp": 1622881474.262,
      "category": "fetch",
      "data": {
        "method": "POST",
        "url": "https://google-analytics.com/collect",
        "status_code": 200
      },
      "type": "http"
    },
    {
      "timestamp": 1622881474.265,
      "category": "navigation",
      "data": {
        "from": "/watch/40748/16/#t=0",
        "to": "/watch/40748/16/3462035/#t=0"
      }
    },
    {
      "timestamp": 1622881474.297,
      "category": "fetch",
      "data": {
        "method": "GET",
        "url": "https://smotret-anime.online/api/series?...",
        "status_code": 200
      },
      "type": "http"
    },
    {
      "timestamp": 1622881474.297,
      "category": "fetch",
      "data": {
        "method": "GET",
        "url": "https://smotret-anime.online/api/series?...",
        "status_code": 200
      },
      "type": "http"
    },
    {
      "timestamp": 1622881474.298,
      "category": "fetch",
      "data": {
        "method": "POST",
        "url": "https://google-analytics.com/collect",
        "status_code": 200
      },
      "type": "http"
    },
    {
      "timestamp": 1622881474.304,
      "category": "fetch",
      "data": {
        "method": "GET",
        "url": "https://smotret-anime.online/api/translations?...",
        "status_code": 200
      },
      "type": "http"
    },
    {
      "timestamp": 1622881474.309,
      "category": "fetch",
      "data": {
        "method": "GET",
        "url": "https://smotret-anime.online/api/translations?...",
        "status_code": 200
      },
      "type": "http"
    },
    {
      "timestamp": 1622881474.317,
      "category": "fetch",
      "data": {
        "method": "POST",
        "url": "https://google-analytics.com/collect",
        "status_code": 200
      },
      "type": "http"
    },
    {
      "timestamp": 1622881474.323,
      "category": "fetch",
      "data": {
        "method": "GET",
        "url": "https://smotret-anime.online/api/translations/embed/3462035",
        "status_code": 200
      },
      "type": "http"
    },
    {
      "timestamp": 1622881474.327,
      "category": "fetch",
      "data": {
        "method": "GET",
        "url": "https://smotret-anime.online/api/translations/embed/3469142",
        "status_code": 200
      },
      "type": "http"
    },
    {
      "timestamp": 1622881474.328,
      "category": "console",
      "data": {
        "arguments": [
          {
            "code": 403,
            "message": "You should login first."
          }
        ],
        "logger": "console"
      },
      "level": "error",
      "message": "[object Object]"
    }
  ],
  "request": {
    "url": "anime-lib://./watch/40748/16/3462035/#t=0",
    "headers": {
      "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) anime-library/21.6.5-504 Chrome/91.0.4472.77 Electron/13.1.0 Safari/537.36"
    }
  }
}

As you can see the event contains both event.exception.values and event.stacktrace. But only event.exception.values will be rewrited and event.stacktrace will not.

My Config.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions