From 580d8c4dfe9b1a0e80f23111635cf89a9b8835b9 Mon Sep 17 00:00:00 2001 From: Satyam Bansal Date: Tue, 30 May 2023 10:11:20 +0530 Subject: [PATCH] integrations: Add exception fixture for Vue in Sentry Integration. --- .../fixtures/event_for_exception_vue.json | 565 ++++++++++++++++++ zerver/webhooks/sentry/tests.py | 11 + 2 files changed, 576 insertions(+) create mode 100644 zerver/webhooks/sentry/fixtures/event_for_exception_vue.json diff --git a/zerver/webhooks/sentry/fixtures/event_for_exception_vue.json b/zerver/webhooks/sentry/fixtures/event_for_exception_vue.json new file mode 100644 index 0000000000..65f418e7d0 --- /dev/null +++ b/zerver/webhooks/sentry/fixtures/event_for_exception_vue.json @@ -0,0 +1,565 @@ +{ + "action": "triggered", + "installation": { + "uuid": "be1b14f8-ffad-41af-8e97-24a9c32ebc26" + }, + "data": { + "event": { + "event_id": "292f78454e774e62999506f759ad791d", + "project": 4505266924748801, + "release": null, + "dist": null, + "platform": "javascript", + "message": "", + "datetime": "2023-05-29T11:08:30.821000Z", + "tags": [ + [ + "browser", + "Chrome 110.0.0" + ], + [ + "browser.name", + "Chrome" + ], + [ + "environment", + "production" + ], + [ + "handled", + "no" + ], + [ + "level", + "error" + ], + [ + "mechanism", + "onunhandledrejection" + ], + [ + "os.name", + "Linux" + ], + [ + "replayId", + "f6eba8bdc1824d4faec200863e316c32" + ], + [ + "user", + "ip:49.36.170.187" + ], + [ + "transaction", + "home" + ], + [ + "url", + "http://localhost:5173/" + ] + ], + "_metrics": { + "bytes.ingested.event": 6013, + "bytes.stored.event": 21343 + }, + "_ref": 4505266924748801, + "_ref_version": 2, + "breadcrumbs": { + "values": [ + { + "timestamp": 1685358510.768, + "type": "default", + "category": "console", + "level": "warning", + "message": "[@sentry/vue]: Misconfigured SDK. Vue app is already mounted. Make sure to call `app.mount()` after `Sentry.init()`.", + "data": { + "arguments": [ + "[@sentry/vue]: Misconfigured SDK. Vue app is already mounted. Make sure to call `app.mount()` after `Sentry.init()`." + ], + "logger": "console" + } + }, + { + "timestamp": 1685358510.768, + "type": "default", + "category": "console", + "level": "warning", + "message": "[Vue warn]: Plugin has already been applied to target app.", + "data": { + "arguments": [ + "[Vue warn]: Plugin has already been applied to target app." + ], + "logger": "console" + } + }, + { + "timestamp": 1685358510.769, + "type": "default", + "category": "console", + "level": "warning", + "message": "[Vue warn]: App has already been mounted.\nIf you want to remount the same app, move your app creation logic into a factory function and create fresh app instances for each mount - e.g. `const createMyApp = () => createApp(App)`", + "data": { + "arguments": [ + "[Vue warn]: App has already been mounted.\nIf you want to remount the same app, move your app creation logic into a factory function and create fresh app instances for each mount - e.g. `const createMyApp = () => createApp(App)`" + ], + "logger": "console" + } + }, + { + "timestamp": 1685358510.769, + "type": "default", + "category": "navigation", + "level": "info", + "data": { + "from": "/", + "to": "/" + } + }, + { + "timestamp": 1685358510.778, + "type": "default", + "category": "console", + "level": "warning", + "message": "[Vue warn]: Unhandled error during execution of scheduler flush. This is likely a Vue internals bug. Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core \n at ref=Ref< viewRef > > \n at \n at ", + "data": { + "arguments": [ + "[Vue warn]: Unhandled error during execution of scheduler flush. This is likely a Vue internals bug. Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core", + "\n", + " at ", + "ref=Ref<", + "viewRef", + ">", + ">", + "\n", + " at ", + "\n", + " at " + ], + "logger": "console" + } + } + ] + }, + "contexts": { + "browser": { + "name": "Chrome", + "version": "110.0.0", + "type": "browser" + }, + "os": { + "name": "Linux", + "type": "os" + }, + "replay": { + "replay_id": "f6eba8bdc1824d4faec200863e316c32", + "type": "replay" + }, + "trace": { + "trace_id": "b1b7eb2d91cc4d0580d3f9b72d3a244c", + "span_id": "86a7afb4c705ca3c", + "op": "pageload", + "status": "internal_error", + "client_sample_rate": 1.0, + "sampled": true, + "data": { + "params": {}, + "query": {} + }, + "tags": { + "routing.instrumentation": "vue-router" + }, + "type": "trace" + } + }, + "culprit": "insert(deps/chunk-G4DFXOZZ)", + "environment": "production", + "errors": [ + { + "type": "js_no_source", + "url": "http://localhost:5173/node_modules/.vite/deps/chunk-G4DFXOZZ.js?v=530d9f5f" + } + ], + "exception": { + "values": [ + { + "type": "TypeError", + "value": "Cannot read properties of null (reading 'insertBefore')", + "stacktrace": { + "frames": [ + { + "function": "flushJobs", + "module": "deps/chunk-G4DFXOZZ", + "filename": "/node_modules/.vite/deps/chunk-G4DFXOZZ.js", + "abs_path": "http://localhost:5173/node_modules/.vite/deps/chunk-G4DFXOZZ.js?v=530d9f5f", + "lineno": 1763, + "colno": 9, + "in_app": true + }, + { + "function": "callWithErrorHandling", + "module": "deps/chunk-G4DFXOZZ", + "filename": "/node_modules/.vite/deps/chunk-G4DFXOZZ.js", + "abs_path": "http://localhost:5173/node_modules/.vite/deps/chunk-G4DFXOZZ.js?v=530d9f5f", + "lineno": 1565, + "colno": 32, + "in_app": true + }, + { + "function": "instance.update", + "module": "deps/chunk-G4DFXOZZ", + "filename": "/node_modules/.vite/deps/chunk-G4DFXOZZ.js", + "abs_path": "http://localhost:5173/node_modules/.vite/deps/chunk-G4DFXOZZ.js?v=530d9f5f", + "lineno": 7212, + "colno": 52, + "in_app": true + }, + { + "function": "ReactiveEffect.run", + "module": "deps/chunk-G4DFXOZZ", + "filename": "/node_modules/.vite/deps/chunk-G4DFXOZZ.js", + "abs_path": "http://localhost:5173/node_modules/.vite/deps/chunk-G4DFXOZZ.js?v=530d9f5f", + "lineno": 423, + "colno": 19, + "in_app": true + }, + { + "function": "ReactiveEffect.componentUpdateFn [as fn]", + "module": "deps/chunk-G4DFXOZZ", + "filename": "/node_modules/.vite/deps/chunk-G4DFXOZZ.js", + "abs_path": "http://localhost:5173/node_modules/.vite/deps/chunk-G4DFXOZZ.js?v=530d9f5f", + "lineno": 7171, + "colno": 9, + "in_app": true + }, + { + "function": "patch", + "module": "deps/chunk-G4DFXOZZ", + "filename": "/node_modules/.vite/deps/chunk-G4DFXOZZ.js", + "abs_path": "http://localhost:5173/node_modules/.vite/deps/chunk-G4DFXOZZ.js?v=530d9f5f", + "lineno": 6436, + "colno": 11, + "in_app": true + }, + { + "function": "processComponent", + "module": "deps/chunk-G4DFXOZZ", + "filename": "/node_modules/.vite/deps/chunk-G4DFXOZZ.js", + "abs_path": "http://localhost:5173/node_modules/.vite/deps/chunk-G4DFXOZZ.js?v=530d9f5f", + "lineno": 6963, + "colno": 9, + "in_app": true + }, + { + "function": "mountComponent", + "module": "deps/chunk-G4DFXOZZ", + "filename": "/node_modules/.vite/deps/chunk-G4DFXOZZ.js", + "abs_path": "http://localhost:5173/node_modules/.vite/deps/chunk-G4DFXOZZ.js?v=530d9f5f", + "lineno": 7010, + "colno": 5, + "in_app": true + }, + { + "function": "setupRenderEffect", + "module": "deps/chunk-G4DFXOZZ", + "filename": "/node_modules/.vite/deps/chunk-G4DFXOZZ.js", + "abs_path": "http://localhost:5173/node_modules/.vite/deps/chunk-G4DFXOZZ.js?v=530d9f5f", + "lineno": 7220, + "colno": 5, + "in_app": true + }, + { + "function": "instance.update", + "module": "deps/chunk-G4DFXOZZ", + "filename": "/node_modules/.vite/deps/chunk-G4DFXOZZ.js", + "abs_path": "http://localhost:5173/node_modules/.vite/deps/chunk-G4DFXOZZ.js?v=530d9f5f", + "lineno": 7212, + "colno": 52, + "in_app": true + }, + { + "function": "ReactiveEffect.run", + "module": "deps/chunk-G4DFXOZZ", + "filename": "/node_modules/.vite/deps/chunk-G4DFXOZZ.js", + "abs_path": "http://localhost:5173/node_modules/.vite/deps/chunk-G4DFXOZZ.js?v=530d9f5f", + "lineno": 423, + "colno": 19, + "in_app": true + }, + { + "function": "ReactiveEffect.componentUpdateFn [as fn]", + "module": "deps/chunk-G4DFXOZZ", + "filename": "/node_modules/.vite/deps/chunk-G4DFXOZZ.js", + "abs_path": "http://localhost:5173/node_modules/.vite/deps/chunk-G4DFXOZZ.js?v=530d9f5f", + "lineno": 7106, + "colno": 11, + "in_app": true + }, + { + "function": "patch", + "module": "deps/chunk-G4DFXOZZ", + "filename": "/node_modules/.vite/deps/chunk-G4DFXOZZ.js", + "abs_path": "http://localhost:5173/node_modules/.vite/deps/chunk-G4DFXOZZ.js?v=530d9f5f", + "lineno": 6424, + "colno": 11, + "in_app": true + }, + { + "function": "processElement", + "module": "deps/chunk-G4DFXOZZ", + "filename": "/node_modules/.vite/deps/chunk-G4DFXOZZ.js", + "abs_path": "http://localhost:5173/node_modules/.vite/deps/chunk-G4DFXOZZ.js?v=530d9f5f", + "lineno": 6552, + "colno": 7, + "in_app": true + }, + { + "function": "mountElement", + "module": "deps/chunk-G4DFXOZZ", + "filename": "/node_modules/.vite/deps/chunk-G4DFXOZZ.js", + "abs_path": "http://localhost:5173/node_modules/.vite/deps/chunk-G4DFXOZZ.js?v=530d9f5f", + "lineno": 6642, + "colno": 5, + "in_app": true + }, + { + "function": "insert", + "module": "deps/chunk-G4DFXOZZ", + "filename": "/node_modules/.vite/deps/chunk-G4DFXOZZ.js", + "abs_path": "http://localhost:5173/node_modules/.vite/deps/chunk-G4DFXOZZ.js?v=530d9f5f", + "lineno": 9134, + "colno": 12, + "in_app": true + } + ] + }, + "raw_stacktrace": { + "frames": [ + { + "function": "flushJobs", + "filename": "/node_modules/.vite/deps/chunk-G4DFXOZZ.js", + "abs_path": "http://localhost:5173/node_modules/.vite/deps/chunk-G4DFXOZZ.js?v=530d9f5f", + "lineno": 1763, + "colno": 9, + "in_app": true + }, + { + "function": "callWithErrorHandling", + "filename": "/node_modules/.vite/deps/chunk-G4DFXOZZ.js", + "abs_path": "http://localhost:5173/node_modules/.vite/deps/chunk-G4DFXOZZ.js?v=530d9f5f", + "lineno": 1565, + "colno": 32, + "in_app": true + }, + { + "function": "instance.update", + "filename": "/node_modules/.vite/deps/chunk-G4DFXOZZ.js", + "abs_path": "http://localhost:5173/node_modules/.vite/deps/chunk-G4DFXOZZ.js?v=530d9f5f", + "lineno": 7212, + "colno": 52, + "in_app": true + }, + { + "function": "ReactiveEffect.run", + "filename": "/node_modules/.vite/deps/chunk-G4DFXOZZ.js", + "abs_path": "http://localhost:5173/node_modules/.vite/deps/chunk-G4DFXOZZ.js?v=530d9f5f", + "lineno": 423, + "colno": 19, + "in_app": true + }, + { + "function": "ReactiveEffect.componentUpdateFn [as fn]", + "filename": "/node_modules/.vite/deps/chunk-G4DFXOZZ.js", + "abs_path": "http://localhost:5173/node_modules/.vite/deps/chunk-G4DFXOZZ.js?v=530d9f5f", + "lineno": 7171, + "colno": 9, + "in_app": true + }, + { + "function": "patch", + "filename": "/node_modules/.vite/deps/chunk-G4DFXOZZ.js", + "abs_path": "http://localhost:5173/node_modules/.vite/deps/chunk-G4DFXOZZ.js?v=530d9f5f", + "lineno": 6436, + "colno": 11, + "in_app": true + }, + { + "function": "processComponent", + "filename": "/node_modules/.vite/deps/chunk-G4DFXOZZ.js", + "abs_path": "http://localhost:5173/node_modules/.vite/deps/chunk-G4DFXOZZ.js?v=530d9f5f", + "lineno": 6963, + "colno": 9, + "in_app": true + }, + { + "function": "mountComponent", + "filename": "/node_modules/.vite/deps/chunk-G4DFXOZZ.js", + "abs_path": "http://localhost:5173/node_modules/.vite/deps/chunk-G4DFXOZZ.js?v=530d9f5f", + "lineno": 7010, + "colno": 5, + "in_app": true + }, + { + "function": "setupRenderEffect", + "filename": "/node_modules/.vite/deps/chunk-G4DFXOZZ.js", + "abs_path": "http://localhost:5173/node_modules/.vite/deps/chunk-G4DFXOZZ.js?v=530d9f5f", + "lineno": 7220, + "colno": 5, + "in_app": true + }, + { + "function": "instance.update", + "filename": "/node_modules/.vite/deps/chunk-G4DFXOZZ.js", + "abs_path": "http://localhost:5173/node_modules/.vite/deps/chunk-G4DFXOZZ.js?v=530d9f5f", + "lineno": 7212, + "colno": 52, + "in_app": true + }, + { + "function": "ReactiveEffect.run", + "filename": "/node_modules/.vite/deps/chunk-G4DFXOZZ.js", + "abs_path": "http://localhost:5173/node_modules/.vite/deps/chunk-G4DFXOZZ.js?v=530d9f5f", + "lineno": 423, + "colno": 19, + "in_app": true + }, + { + "function": "ReactiveEffect.componentUpdateFn [as fn]", + "filename": "/node_modules/.vite/deps/chunk-G4DFXOZZ.js", + "abs_path": "http://localhost:5173/node_modules/.vite/deps/chunk-G4DFXOZZ.js?v=530d9f5f", + "lineno": 7106, + "colno": 11, + "in_app": true + }, + { + "function": "patch", + "filename": "/node_modules/.vite/deps/chunk-G4DFXOZZ.js", + "abs_path": "http://localhost:5173/node_modules/.vite/deps/chunk-G4DFXOZZ.js?v=530d9f5f", + "lineno": 6424, + "colno": 11, + "in_app": true + }, + { + "function": "processElement", + "filename": "/node_modules/.vite/deps/chunk-G4DFXOZZ.js", + "abs_path": "http://localhost:5173/node_modules/.vite/deps/chunk-G4DFXOZZ.js?v=530d9f5f", + "lineno": 6552, + "colno": 7, + "in_app": true + }, + { + "function": "mountElement", + "filename": "/node_modules/.vite/deps/chunk-G4DFXOZZ.js", + "abs_path": "http://localhost:5173/node_modules/.vite/deps/chunk-G4DFXOZZ.js?v=530d9f5f", + "lineno": 6642, + "colno": 5, + "in_app": true + }, + { + "function": "insert", + "filename": "/node_modules/.vite/deps/chunk-G4DFXOZZ.js", + "abs_path": "http://localhost:5173/node_modules/.vite/deps/chunk-G4DFXOZZ.js?v=530d9f5f", + "lineno": 9134, + "colno": 12, + "in_app": true + } + ] + }, + "mechanism": { + "type": "onunhandledrejection", + "handled": false + } + } + ] + }, + "fingerprint": [ + "{{ default }}" + ], + "grouping_config": { + "enhancements": "eJybzDRxY3J-bm5-npWRgaGlroGxrpHxBABcYgcZ", + "id": "newstyle:2019-10-29" + }, + "hashes": [ + "fdd7bfccd74d70129094ae0482059ab1" + ], + "ingest_path": [ + { + "version": "23.5.1", + "public_key": "XE7QiyuNlja9PZ7I9qJlwQotzecWrUIN91BAO7Q5R38" + } + ], + "key_id": "3162314", + "level": "error", + "location": "/node_modules/.vite/deps/chunk-G4DFXOZZ.js", + "logger": "", + "metadata": { + "display_title_with_tree_label": false, + "filename": "/node_modules/.vite/deps/chunk-G4DFXOZZ.js", + "function": "insert", + "type": "TypeError", + "value": "Cannot read properties of null (reading 'insertBefore')" + }, + "nodestore_insert": 1685358514.576503, + "processed_by_symbolicator": true, + "received": 1685358510.991622, + "request": { + "url": "http://localhost:5173/", + "headers": [ + [ + "Referer", + "http://localhost:5173/" + ], + [ + "User-Agent", + "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36" + ] + ] + }, + "sdk": { + "name": "sentry.javascript.vue", + "version": "7.53.1", + "integrations": [ + "InboundFilters", + "FunctionToString", + "TryCatch", + "Breadcrumbs", + "GlobalHandlers", + "LinkedErrors", + "Dedupe", + "HttpContext", + "BrowserTracing", + "Replay" + ], + "packages": [ + { + "name": "npm:@sentry/vue", + "version": "7.53.1" + } + ] + }, + "timestamp": 1685358510.821, + "title": "TypeError: Cannot read properties of null (reading 'insertBefore')", + "type": "error", + "user": { + "ip_address": "49.36.170.187", + "geo": { + "country_code": "IN", + "city": "Lucknow", + "subdivision": "Uttar Pradesh", + "region": "India" + } + }, + "version": "7", + "url": "https://sentry.io/api/0/projects/nitk-46/javascript-vue-new/events/292f78454e774e62999506f759ad791d/", + "web_url": "https://sentry.io/organizations/nitk-46/issues/4214010673/events/292f78454e774e62999506f759ad791d/", + "issue_url": "https://sentry.io/api/0/issues/4214010673/", + "issue_id": "4214010673" + }, + "triggered_rule": "vue-alert" + }, + "actor": { + "type": "application", + "id": "sentry", + "name": "Sentry" + } +} diff --git a/zerver/webhooks/sentry/tests.py b/zerver/webhooks/sentry/tests.py index 9d580dc37e..c32265038d 100644 --- a/zerver/webhooks/sentry/tests.py +++ b/zerver/webhooks/sentry/tests.py @@ -111,6 +111,17 @@ Traceback: ```""" self.check_webhook("event_for_exception_rails", expected_topic, expected_message) + def test_event_for_exception_vue(self) -> None: + expected_topic = "TypeError: Cannot read properties of null (reading 'inser..." + expected_message = """\ +**New exception:** [TypeError: Cannot read properties of null (reading 'insertBefore')](https://sentry.io/organizations/nitk-46/issues/4214010673/events/292f78454e774e62999506f759ad791d/) +```quote +**level:** error +**timestamp:** 2023-05-29 11:08:30 +**filename:** /node_modules/.vite/deps/chunk-G4DFXOZZ.js +```""" + self.check_webhook("event_for_exception_vue", expected_topic, expected_message) + def test_webhook_event_for_exception_python(self) -> None: expected_topic = "ValueError: new sentry error." expected_message = """\