diff --git a/.env b/.env index 55ce932c..6ae63dbc 100644 --- a/.env +++ b/.env @@ -5,4 +5,7 @@ #### # The room id for the space to use for listing public group call rooms -# VITE_PUBLIC_SPACE_ROOM_ID=!hjdfshkdskjdsk:myhomeserver.com \ No newline at end of file +# VITE_PUBLIC_SPACE_ROOM_ID=!hjdfshkdskjdsk:myhomeserver.com + +# The Sentry DSN to use for error reporting. Leave undefined to disable. +# VITE_SENTRY_DSN=https://examplePublicKey@o0.ingest.sentry.io/0 \ No newline at end of file diff --git a/package.json b/package.json index a96bc729..5428762f 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,8 @@ "serve": "vite preview" }, "dependencies": { + "@sentry/react": "^6.13.3", + "@sentry/tracing": "^6.13.3", "classnames": "^2.3.1", "color-hash": "^2.0.1", "events": "^3.3.0", diff --git a/src/App.jsx b/src/App.jsx index d69637f2..b136ccd3 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -22,6 +22,7 @@ import { Redirect, useLocation, } from "react-router-dom"; +import * as Sentry from "@sentry/react"; import { useClient } from "./ConferenceCallManagerHooks"; import { Home } from "./Home"; import { Room } from "./Room"; @@ -30,6 +31,8 @@ import { LoginPage } from "./LoginPage"; import { Center } from "./Layout"; import { GuestAuthPage } from "./GuestAuthPage"; +const SentryRoute = Sentry.withSentryRouting(Route); + export default function App() { const { protocol, host } = window.location; // Assume homeserver is hosted on same domain (proxied in development by vite) @@ -56,19 +59,19 @@ export default function App() { - + - - + + - - + + {authenticated ? ( ) : ( )} - + )} @@ -80,7 +83,7 @@ function AuthenticatedRoute({ authenticated, children, ...rest }) { const location = useLocation(); return ( - + {authenticated ? ( children ) : ( @@ -91,6 +94,6 @@ function AuthenticatedRoute({ authenticated, children, ...rest }) { }} /> )} - + ); } diff --git a/src/main.jsx b/src/main.jsx index b757ad8e..c8c423c0 100644 --- a/src/main.jsx +++ b/src/main.jsx @@ -16,12 +16,29 @@ limitations under the License. import React from "react"; import ReactDOM from "react-dom"; +import { createBrowserHistory } from "history"; import "./index.css"; import App from "./App"; +import * as Sentry from "@sentry/react"; +import { Integrations } from "@sentry/tracing"; + +const history = createBrowserHistory(); + +Sentry.init({ + dsn: import.meta.env.VITE_SENTRY_DSN, + integrations: [ + new Integrations.BrowserTracing({ + routingInstrumentation: Sentry.reactRouterV5Instrumentation(history), + }), + ], + tracesSampleRate: 1.0, +}); ReactDOM.render( - + An error has occurred

}> + +
, document.getElementById("root") ); diff --git a/yarn.lock b/yarn.lock index accbdf5f..7eab13bf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -253,6 +253,16 @@ "@react-spring/shared" "~9.2.0" "@react-spring/types" "~9.2.0" +"@sentry/browser@6.13.3": + version "6.13.3" + resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-6.13.3.tgz#d4511791b1e484ad48785eba3bce291fdf115c1e" + integrity sha512-jwlpsk2/u1cofvfYsjmqcnx50JJtf/T6HTgdW+ih8+rqWC5ABEZf4IiB/H+KAyjJ3wVzCOugMq5irL83XDCfqQ== + dependencies: + "@sentry/core" "6.13.3" + "@sentry/types" "6.13.3" + "@sentry/utils" "6.13.3" + tslib "^1.9.3" + "@sentry/browser@^6.11.0": version "6.13.2" resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-6.13.2.tgz#8b731ecf8c3cdd92a4b6893a26f975fd5844056d" @@ -274,6 +284,17 @@ "@sentry/utils" "6.13.2" tslib "^1.9.3" +"@sentry/core@6.13.3": + version "6.13.3" + resolved "https://registry.yarnpkg.com/@sentry/core/-/core-6.13.3.tgz#5cbbb995128e793ebebcbf1d3b7514e0e5e8b221" + integrity sha512-obm3SjgCk8A7nB37b2AU1eq1q7gMoJRrGMv9VRIyfcG0Wlz/5lJ9O3ohUk+YZaaVfZMxXn6hFtsBiOWmlv7IIA== + dependencies: + "@sentry/hub" "6.13.3" + "@sentry/minimal" "6.13.3" + "@sentry/types" "6.13.3" + "@sentry/utils" "6.13.3" + tslib "^1.9.3" + "@sentry/hub@6.13.2": version "6.13.2" resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-6.13.2.tgz#ebc66fd55c96c7686a53ffd3521b6a63f883bb79" @@ -283,6 +304,15 @@ "@sentry/utils" "6.13.2" tslib "^1.9.3" +"@sentry/hub@6.13.3": + version "6.13.3" + resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-6.13.3.tgz#cc09623a69b5343315fdb61c7fdd0be74b72299f" + integrity sha512-eYppBVqvhs5cvm33snW2sxfcw6G20/74RbBn+E4WDo15hozis89kU7ZCJDOPkXuag3v1h9igns/kM6PNBb41dw== + dependencies: + "@sentry/types" "6.13.3" + "@sentry/utils" "6.13.3" + tslib "^1.9.3" + "@sentry/minimal@6.13.2": version "6.13.2" resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-6.13.2.tgz#de3ecc62b9463bf56ccdbcf4c75f7ea1aeeebc11" @@ -292,6 +322,27 @@ "@sentry/types" "6.13.2" tslib "^1.9.3" +"@sentry/minimal@6.13.3": + version "6.13.3" + resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-6.13.3.tgz#a675a79bcc830142e4f95e6198a2efde2cd3901e" + integrity sha512-63MlYYRni3fs5Bh8XBAfVZ+ctDdWg0fapSTP1ydIC37fKvbE+5zhyUqwrEKBIiclEApg1VKX7bkKxVdu/vsFdw== + dependencies: + "@sentry/hub" "6.13.3" + "@sentry/types" "6.13.3" + tslib "^1.9.3" + +"@sentry/react@^6.13.3": + version "6.13.3" + resolved "https://registry.yarnpkg.com/@sentry/react/-/react-6.13.3.tgz#f9607e0a60d52efd0baa96a14e694b6059f9379a" + integrity sha512-fdfmD9XNpGDwdkeLyd+iq+kqtNeghpH3wiez2rD81ZBvrn70uKaO2/yYDE71AXC6fUOwQuJmdfAuqBcNJkYIEw== + dependencies: + "@sentry/browser" "6.13.3" + "@sentry/minimal" "6.13.3" + "@sentry/types" "6.13.3" + "@sentry/utils" "6.13.3" + hoist-non-react-statics "^3.3.2" + tslib "^1.9.3" + "@sentry/tracing@^6.11.0": version "6.13.2" resolved "https://registry.yarnpkg.com/@sentry/tracing/-/tracing-6.13.2.tgz#512389ba459f48ae75e14f1528ab062dc46e4956" @@ -303,11 +354,27 @@ "@sentry/utils" "6.13.2" tslib "^1.9.3" +"@sentry/tracing@^6.13.3": + version "6.13.3" + resolved "https://registry.yarnpkg.com/@sentry/tracing/-/tracing-6.13.3.tgz#ca657d4afa99c50f15e638fe38405bac33e780ee" + integrity sha512-yyOFIhqlprPM0g4f35Icear3eZk2mwyYcGEzljJfY2iU6pJwj1lzia5PfSwiCW7jFGMmlBJNhOAIpfhlliZi8Q== + dependencies: + "@sentry/hub" "6.13.3" + "@sentry/minimal" "6.13.3" + "@sentry/types" "6.13.3" + "@sentry/utils" "6.13.3" + tslib "^1.9.3" + "@sentry/types@6.13.2": version "6.13.2" resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.13.2.tgz#8388d5b92ea8608936e7aae842801dc90e0184e6" integrity sha512-6WjGj/VjjN8LZDtqJH5ikeB1o39rO1gYS6anBxiS3d0sXNBb3Ux0pNNDFoBxQpOhmdDHXYS57MEptX9EV82gmg== +"@sentry/types@6.13.3": + version "6.13.3" + resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.13.3.tgz#63ad5b6735b0dfd90b3a256a9f8e77b93f0f66b2" + integrity sha512-Vrz5CdhaTRSvCQjSyIFIaV9PodjAVFkzJkTRxyY7P77RcegMsRSsG1yzlvCtA99zG9+e6MfoJOgbOCwuZids5A== + "@sentry/utils@6.13.2": version "6.13.2" resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-6.13.2.tgz#fb8010e7b67cc8c084d8067d64ef25289269cda5" @@ -316,6 +383,14 @@ "@sentry/types" "6.13.2" tslib "^1.9.3" +"@sentry/utils@6.13.3": + version "6.13.3" + resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-6.13.3.tgz#188754d40afe693c3fcae410f9322531588a9926" + integrity sha512-zYFuFH3MaYtBZTeJ4Yajg7pDf0pM3MWs3+9k5my9Fd+eqNcl7dYQYJbT9gyC0HXK1QI4CAMNNlHNl4YXhF91ag== + dependencies: + "@sentry/types" "6.13.3" + tslib "^1.9.3" + "@svgr/babel-plugin-add-jsx-attribute@^5.4.0": version "5.4.0" resolved "https://registry.npmjs.org/@svgr/babel-plugin-add-jsx-attribute/-/babel-plugin-add-jsx-attribute-5.4.0.tgz"