Enable frontend exception tracking (#140)
This commit is contained in:
parent
d05f04be9f
commit
aa645d9b15
@ -1 +1,2 @@
|
||||
API_BASE_URL=https://btrix.webrecorder.net/api
|
||||
GLITCHTIP_DSN=
|
@ -1 +1,2 @@
|
||||
API_BASE_URL=https://btrix-dev.webrecorder.net/api
|
||||
GLITCHTIP_DSN=
|
@ -9,8 +9,26 @@
|
||||
<title>Browsertrix Cloud</title>
|
||||
<base href="/" />
|
||||
<script defer src="<%= rwp_base_url %>ui.js"></script>
|
||||
<script
|
||||
src="https://unpkg.com/@sentry/browser@latest/build/bundle.min.js"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
</head>
|
||||
<body>
|
||||
<browsertrix-app></browsertrix-app>
|
||||
|
||||
<script>
|
||||
const dsn = "<%= glitchtip_dsn %>"
|
||||
|
||||
if (dsn) {
|
||||
Sentry.init({
|
||||
dsn: dsn,
|
||||
release: "<%= commit_hash %>",
|
||||
environment: "<%= environment %>",
|
||||
debug: "<%= environment %>" === "development",
|
||||
autoSessionTracking: false, // Turn off unsupported page/session tracking
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -4,6 +4,7 @@ const ESLintPlugin = require("eslint-webpack-plugin");
|
||||
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
||||
const CopyPlugin = require("copy-webpack-plugin");
|
||||
const Dotenv = require("dotenv-webpack");
|
||||
const childProcess = require("child_process");
|
||||
|
||||
const isDevServer = process.env.WEBPACK_SERVE;
|
||||
|
||||
@ -14,6 +15,16 @@ const dotEnvPath = path.resolve(
|
||||
process.cwd(),
|
||||
`.env${isDevServer ? `.local` : ""}`
|
||||
);
|
||||
// Get git info to use as Glitchtip release version
|
||||
|
||||
const gitBranch = childProcess
|
||||
.execSync("git rev-parse --abbrev-ref HEAD")
|
||||
.toString()
|
||||
.trim();
|
||||
const commitHash = childProcess
|
||||
.execSync("git rev-parse --short HEAD")
|
||||
.toString()
|
||||
.trim();
|
||||
|
||||
require("dotenv").config({
|
||||
path: dotEnvPath,
|
||||
@ -107,6 +118,9 @@ module.exports = {
|
||||
template: "src/index.ejs",
|
||||
templateParameters: {
|
||||
rwp_base_url: RWP_BASE_URL,
|
||||
glitchtip_dsn: process.env.GLITCHTIP_DSN || "",
|
||||
environment: isDevServer ? "development" : "production",
|
||||
commit_hash: `${gitBranch} (${commitHash})`,
|
||||
},
|
||||
// Need to block during local development for HMR:
|
||||
inject: isDevServer ? "head" : true,
|
||||
|
Loading…
Reference in New Issue
Block a user