From 46476bef28d4a194bd59d018e832d14e58c84cb4 Mon Sep 17 00:00:00 2001 From: Gilbert Date: Wed, 1 May 2024 15:00:52 -0500 Subject: [PATCH] Add bugsnag --- packages/frontend/package.json | 5 +- packages/frontend/src/index.tsx | 35 ++++++-- yarn.lock | 146 +++++++++++++++++++++++++------- 3 files changed, 148 insertions(+), 38 deletions(-) diff --git a/packages/frontend/package.json b/packages/frontend/package.json index 56a45e44..a8c1782c 100644 --- a/packages/frontend/package.json +++ b/packages/frontend/package.json @@ -10,6 +10,9 @@ "preview": "vite preview" }, "dependencies": { + "@bugsnag/browser-performance": "^2.4.1", + "@bugsnag/js": "^7.22.7", + "@bugsnag/plugin-react": "^7.22.7", "@fontsource-variable/jetbrains-mono": "^5.0.19", "@fontsource/inter": "^5.0.16", "@radix-ui/react-avatar": "^1.0.4", @@ -66,8 +69,8 @@ "web-vitals": "^2.1.4" }, "devDependencies": { - "@types/lodash": "^4.17.0", "@types/jest": "^27.5.2", + "@types/lodash": "^4.17.0", "@types/luxon": "^3.3.7", "@types/node": "^16.18.68", "@types/react": "^18.2.66", diff --git a/packages/frontend/src/index.tsx b/packages/frontend/src/index.tsx index 43d476b5..dd556cc3 100644 --- a/packages/frontend/src/index.tsx +++ b/packages/frontend/src/index.tsx @@ -13,6 +13,20 @@ import reportWebVitals from './reportWebVitals'; import { GQLClientProvider } from './context/GQLClientContext'; import { SERVER_GQL_PATH } from './constants'; import { Toaster } from 'components/shared/Toast'; + +import Bugsnag from '@bugsnag/js'; +import BugsnagPluginReact from '@bugsnag/plugin-react'; +import BugsnagPerformance from '@bugsnag/browser-performance'; + +const bugsnagApiKey = import.meta.env.VITE_BUGSNAG_API_KEY; +if (bugsnagApiKey) { + Bugsnag.start({ + apiKey: bugsnagApiKey, + plugins: [new BugsnagPluginReact()], + }); + BugsnagPerformance.start({ apiKey: bugsnagApiKey }); +} + const root = ReactDOM.createRoot( document.getElementById('root') as HTMLElement, ); @@ -25,15 +39,20 @@ const gqlEndpoint = `${import.meta.env.VITE_SERVER_URL}/${SERVER_GQL_PATH}`; const gqlClient = new GQLClient({ gqlEndpoint }); +const ErrorBoundary = Bugsnag.getPlugin('react')!.createErrorBoundary(React); + root.render( - - - - - - - - , + + + + + + + + + + , + , ); // If you want to start measuring performance in your app, pass a function diff --git a/yarn.lock b/yarn.lock index b0e1bc38..576c313e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -404,6 +404,90 @@ "@babel/helper-validator-identifier" "^7.22.20" to-fast-properties "^2.0.0" +"@bugsnag/browser-performance@^2.4.1": + version "2.4.1" + resolved "https://registry.yarnpkg.com/@bugsnag/browser-performance/-/browser-performance-2.4.1.tgz#d2db494ab9201ce302509c691b46db57633934ec" + integrity sha512-bCkAQLt/nL8QagAEXo+E2RtCZDQEfvzWAdyePm2IF2b3K3mILKz/EeB8UycOu/6b3cN8d1wgVHX0sg0b7wQKRA== + dependencies: + "@bugsnag/core-performance" "^2.4.1" + "@bugsnag/cuid" "^3.1.0" + "@bugsnag/delivery-fetch-performance" "^2.4.1" + "@bugsnag/request-tracker-performance" "^2.4.1" + +"@bugsnag/browser@^7.22.7": + version "7.22.7" + resolved "https://registry.yarnpkg.com/@bugsnag/browser/-/browser-7.22.7.tgz#ba1f9f3596b9d3cf1b4db11250f8be2f178a78c1" + integrity sha512-70jFkWKscK2osm7bnFbPLevrzHClrygM3UcKetKs/l81Xuzlxnu1SS3onN5OUl9kd9RN4XMFr46Pv5jSqWqImQ== + dependencies: + "@bugsnag/core" "^7.22.7" + +"@bugsnag/core-performance@^2.4.1": + version "2.4.1" + resolved "https://registry.yarnpkg.com/@bugsnag/core-performance/-/core-performance-2.4.1.tgz#ffc90a5f92c23ccce46276b094e60608332b2aa4" + integrity sha512-n9Wniy43eeluBts68t31Wm+k53D1W4FqhJJtevmN/gK7Hv9y94YSkSnam8ZnZr7fF/qrV3gogP28etlfrSogPQ== + dependencies: + "@bugsnag/cuid" "^3.1.0" + +"@bugsnag/core@^7.22.7": + version "7.22.7" + resolved "https://registry.yarnpkg.com/@bugsnag/core/-/core-7.22.7.tgz#ea5e0822b01913c88be4dbc67d388aff8d65f26a" + integrity sha512-9DPWBkkBjhFJc5dCFy/wVC3HE0Aw3ZiLJKjyAxgywSKbILgtpD+qT1Xe8sacWyxU92znamlZ8H8ziQOe7jhhbA== + dependencies: + "@bugsnag/cuid" "^3.0.0" + "@bugsnag/safe-json-stringify" "^6.0.0" + error-stack-parser "^2.0.3" + iserror "0.0.2" + stack-generator "^2.0.3" + +"@bugsnag/cuid@^3.0.0", "@bugsnag/cuid@^3.1.0": + version "3.1.1" + resolved "https://registry.yarnpkg.com/@bugsnag/cuid/-/cuid-3.1.1.tgz#dbd5d76559f6b7a66306fceacf503888883da514" + integrity sha512-d2z4b0rEo3chI07FNN1Xds8v25CNeekecU6FC/2Fs9MxY2EipkZTThVcV2YinMn8dvRUlViKOyC50evoUxg8tw== + +"@bugsnag/delivery-fetch-performance@^2.4.1": + version "2.4.1" + resolved "https://registry.yarnpkg.com/@bugsnag/delivery-fetch-performance/-/delivery-fetch-performance-2.4.1.tgz#0ec25218ef0a7ca44969547e3d7c4950b38feb9b" + integrity sha512-Od7UYr1lmsW0lsgukKOh78m3S3FJ4WX4wpqUdjVqBCapuiorRzHx0VRZTvqY+P0flj4bwVFZAr3TBmoEwDFPdg== + dependencies: + "@bugsnag/core-performance" "^2.4.1" + +"@bugsnag/js@^7.22.7": + version "7.22.7" + resolved "https://registry.yarnpkg.com/@bugsnag/js/-/js-7.22.7.tgz#d631584ae37803b275798544232cef4f7e5afbfc" + integrity sha512-Qq8l06rSDTZtxgNIDpTeXHrin9C30INNbPfnR2CNcEsCmfqyVQb4USPEuRb0xg5wiaLKU9r4IAatMqiCgdzG6A== + dependencies: + "@bugsnag/browser" "^7.22.7" + "@bugsnag/node" "^7.22.7" + +"@bugsnag/node@^7.22.7": + version "7.22.7" + resolved "https://registry.yarnpkg.com/@bugsnag/node/-/node-7.22.7.tgz#85231637527eb0be9baeed4ed88ed226da7ca577" + integrity sha512-Ud8vpX9UkGxoWAk7OigyR7w1eycbsE5uv5KZx0aWiqDPXylvICd42V5ZiWstpkdm9IVFo9AQ4+gmerHPe4Lwrg== + dependencies: + "@bugsnag/core" "^7.22.7" + byline "^5.0.0" + error-stack-parser "^2.0.2" + iserror "^0.0.2" + pump "^3.0.0" + stack-generator "^2.0.3" + +"@bugsnag/plugin-react@^7.22.7": + version "7.22.7" + resolved "https://registry.yarnpkg.com/@bugsnag/plugin-react/-/plugin-react-7.22.7.tgz#9f308cc4c043ee765d77686fca4e4404dc1c88d0" + integrity sha512-CDyCHK5+KMkpf/2vmVC7xqqP4ys25Yuj9M8xVrmP7LC02nFUPt/UzEIt43MSO4Jfw254ZimbsQrhIweabQNyxQ== + +"@bugsnag/request-tracker-performance@^2.4.1": + version "2.4.1" + resolved "https://registry.yarnpkg.com/@bugsnag/request-tracker-performance/-/request-tracker-performance-2.4.1.tgz#eae59cd5fff8a501a160abb022bfff96f1941e58" + integrity sha512-RFKHkX1JTe5q9h5eTndVcHGcnymfl+JbidHmGIiUuxcZ7887E6QvQF9VLfRSxWwCX/CPkO+uYLtvZZIBRcFi7g== + dependencies: + "@bugsnag/core-performance" "^2.4.1" + +"@bugsnag/safe-json-stringify@^6.0.0": + version "6.0.0" + resolved "https://registry.yarnpkg.com/@bugsnag/safe-json-stringify/-/safe-json-stringify-6.0.0.tgz#22abdcd83e008c369902976730c34c150148a758" + integrity sha512-htzFO1Zc57S8kgdRK9mLcPVTW1BY2ijfH7Dk2CeZmspTWKdKqSo1iwmqrq2WtRjFlo8aRZYgLX0wFrDXF/9DLA== + "@coinbase/wallet-sdk@3.9.1": version "3.9.1" resolved "https://registry.yarnpkg.com/@coinbase/wallet-sdk/-/wallet-sdk-3.9.1.tgz#503a14671bb392d653623ef2340934e213ac971f" @@ -4121,7 +4205,7 @@ dependencies: apg-js "^4.1.1" -"@spruceid/siwe-parser@^2.1.2": +"@spruceid/siwe-parser@^2.1.0", "@spruceid/siwe-parser@^2.1.2": version "2.1.2" resolved "https://registry.yarnpkg.com/@spruceid/siwe-parser/-/siwe-parser-2.1.2.tgz#3e13e7d3ac0bfdaf109a07342590eb21daee2fc3" integrity sha512-d/r3S1LwJyMaRAKQ0awmo9whfXeE88Qt00vRj91q5uv5ATtWIQEGJ67Yr5eSZw5zp1/fZCXZYuEckt8lSkereQ== @@ -6655,6 +6739,11 @@ bundle-require@^4.0.0: dependencies: load-tsconfig "^0.2.3" +byline@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/byline/-/byline-5.0.0.tgz#741c5216468eadc457b03410118ad77de8c1ddb1" + integrity sha512-s6webAy+R4SR8XVuJWt2V2rGvhnrhxN+9S15GNuTK3wKPOXFF6RNc+8ug2XhH+2s4f+uudG4kUVYmYOQWL2g0Q== + byte-size@8.1.1: version "8.1.1" resolved "https://registry.yarnpkg.com/byte-size/-/byte-size-8.1.1.tgz#3424608c62d59de5bfda05d31e0313c6174842ae" @@ -7983,6 +8072,13 @@ error-ex@^1.3.1: dependencies: is-arrayish "^0.2.1" +error-stack-parser@^2.0.2, error-stack-parser@^2.0.3: + version "2.1.4" + resolved "https://registry.yarnpkg.com/error-stack-parser/-/error-stack-parser-2.1.4.tgz#229cb01cdbfa84440bfa91876285b94680188286" + integrity sha512-Sk5V6wVazPhq5MhpO+AUxJn5x7XSXGl1R93Vn7i+zS15KDVxQijejNCrz8340/2bgLBjR9GtEG8ZVKONDjcqGQ== + dependencies: + stackframe "^1.3.4" + es-define-property@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/es-define-property/-/es-define-property-1.0.0.tgz#c7faefbdff8b2696cf5f46921edfb77cc4ba3845" @@ -10063,6 +10159,11 @@ isarray@~1.0.0: resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" integrity sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ== +iserror@0.0.2, iserror@^0.0.2: + version "0.0.2" + resolved "https://registry.yarnpkg.com/iserror/-/iserror-0.0.2.tgz#bd53451fe2f668b9f2402c1966787aaa2c7c0bf5" + integrity sha512-oKGGrFVaWwETimP3SiWwjDeY27ovZoyZPHtxblC4hCq9fXxed/jasx+ATWFFjCVSRZng8VTMsN1nDnGo6zMBSw== + isexe@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" @@ -13889,6 +13990,13 @@ ssri@^9.0.1: dependencies: minipass "^3.1.1" +stack-generator@^2.0.3: + version "2.0.10" + resolved "https://registry.yarnpkg.com/stack-generator/-/stack-generator-2.0.10.tgz#8ae171e985ed62287d4f1ed55a1633b3fb53bb4d" + integrity sha512-mwnua/hkqM6pF4k8SnmZ2zfETsRUpWXREfA/goT8SLCV4iOFa4bzOX2nDipWAZFPTjLvQB82f5yaodMVhK0yJQ== + dependencies: + stackframe "^1.3.4" + stack-utils@^2.0.3: version "2.0.6" resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.6.tgz#aaf0748169c02fc33c8232abccf933f54a1cc34f" @@ -13896,6 +14004,11 @@ stack-utils@^2.0.3: dependencies: escape-string-regexp "^2.0.0" +stackframe@^1.3.4: + version "1.3.4" + resolved "https://registry.yarnpkg.com/stackframe/-/stackframe-1.3.4.tgz#b881a004c8c149a5e8efef37d51b16e412943310" + integrity sha512-oeVtt7eWQS+Na6F//S4kJ2K2VbRlS9D43mAlMyVpVWovy9o+jfgH8O9agzANzaiLjclA0oYzUXEM4PurhSUChw== + statuses@2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.1.tgz#55cb000ccf1d48728bd23c685a063998cf1a1b63" @@ -13930,16 +14043,7 @@ strict-uri-encode@^2.0.0: resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz#b9c7330c7042862f6b142dc274bbcc5866ce3546" integrity sha512-QwiXZgpRcKkhTj2Scnn++4PKtWsH0kpzZ62L2R6c/LUVYv7hVnZqcg2+sMuT6R7Jusu1vviK/MFsu6kNJfWlEQ== -"string-width-cjs@npm:string-width@^4.2.0": - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -13983,14 +14087,7 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - -strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -15233,7 +15330,7 @@ workspace@^0.0.1-preview.1: resolved "https://registry.yarnpkg.com/workspace/-/workspace-0.0.1-preview.1.tgz#0ba0a6b92b3dbc7f1502dd12bc27a37b1eec9083" integrity sha512-oPpEvU7NIQ0MW7ReL+EigMUI2JPNp05kmqzWS6zXVUaSq5KxuQzfgxGd8wuurBulBkTaOnEcGge+2rriyDVHkw== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -15251,15 +15348,6 @@ wrap-ansi@^6.0.1, wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" -wrap-ansi@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"