();
const matches = useMatches();
const hideFooter = matches.some((match) => match.handle?.hideFooter === true);
- useEffect(() => {
- Sentry.setUser(sessionData.user);
- }, []);
-
return (
<>
diff --git a/package-lock.json b/package-lock.json
index a320dea..6bc00e8 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -15,9 +15,6 @@
"@remix-run/node": "1.14.3",
"@remix-run/react": "1.14.3",
"@remix-run/server-runtime": "1.14.3",
- "@sentry/browser": "7.3.0",
- "@sentry/node": "7.3.0",
- "@sentry/tracing": "7.3.0",
"@tailwindcss/forms": "0.5.2",
"@tailwindcss/line-clamp": "0.4.0",
"@tailwindcss/typography": "0.5.2",
@@ -4245,99 +4242,6 @@
"url": "https://github.com/fb55/domhandler?sponsor=1"
}
},
- "node_modules/@sentry/browser": {
- "version": "7.3.0",
- "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-7.3.0.tgz",
- "integrity": "sha512-UJMTDbajKNRGrs4ZQNelrPDaATvSZ9uELpPOtPSG6JUvB1BCwGgsgzz55RS0Uqs7B8KhMnDQ0kIn3FMewM4FMg==",
- "dependencies": {
- "@sentry/core": "7.3.0",
- "@sentry/types": "7.3.0",
- "@sentry/utils": "7.3.0",
- "tslib": "^1.9.3"
- },
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/@sentry/core": {
- "version": "7.3.0",
- "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.3.0.tgz",
- "integrity": "sha512-EvuWVlYm0F0+BtIEmQiCL31Fw0cfKSwUTmxc99wvouaabpHBr2zCJHRxaXOWzxS705bYBJEQiFDTIHfoOQZMzA==",
- "dependencies": {
- "@sentry/hub": "7.3.0",
- "@sentry/types": "7.3.0",
- "@sentry/utils": "7.3.0",
- "tslib": "^1.9.3"
- },
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/@sentry/hub": {
- "version": "7.3.0",
- "resolved": "https://registry.npmjs.org/@sentry/hub/-/hub-7.3.0.tgz",
- "integrity": "sha512-0GtTaWf/hoAMoIFY7Ke6eozIbG3FdIPM364sER4SxUQVSklp6AORrV6p82IgWPROK6aj83cPk9Bszgi6RiF/BA==",
- "dependencies": {
- "@sentry/types": "7.3.0",
- "@sentry/utils": "7.3.0",
- "tslib": "^1.9.3"
- },
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/@sentry/node": {
- "version": "7.3.0",
- "resolved": "https://registry.npmjs.org/@sentry/node/-/node-7.3.0.tgz",
- "integrity": "sha512-hPqLQMdpL9MeirtKDCgy0ekptWh58CCUhvcoQ2bYstVBsyMMTNTbiQqF/ClzanrScQ5CEuGWnCbKxrFN/S6cQg==",
- "dependencies": {
- "@sentry/core": "7.3.0",
- "@sentry/hub": "7.3.0",
- "@sentry/types": "7.3.0",
- "@sentry/utils": "7.3.0",
- "cookie": "^0.4.1",
- "https-proxy-agent": "^5.0.0",
- "lru_map": "^0.3.3",
- "tslib": "^1.9.3"
- },
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/@sentry/tracing": {
- "version": "7.3.0",
- "resolved": "https://registry.npmjs.org/@sentry/tracing/-/tracing-7.3.0.tgz",
- "integrity": "sha512-A+mLEH8jtLkhfyw81EZA1XgI96jh9TIwH9EST3hdfSPgdZQf0A5sV8oVVh/d9Hw7NVb65Va5KhAZDNhcx5QxUA==",
- "dependencies": {
- "@sentry/hub": "7.3.0",
- "@sentry/types": "7.3.0",
- "@sentry/utils": "7.3.0",
- "tslib": "^1.9.3"
- },
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/@sentry/types": {
- "version": "7.3.0",
- "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.3.0.tgz",
- "integrity": "sha512-cGkHdh9+uvbFTj65TjWcXuhe6vQiMY+U+N2GE5xCfmZT9hwuouCASViNsbJMpZqvCg+Yi0fasQLZ71rujiRNOA==",
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/@sentry/utils": {
- "version": "7.3.0",
- "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.3.0.tgz",
- "integrity": "sha512-xUP8TBf2p/c6CN8eFQ7Y+xk0IFrJXsph5ScozqNl/2l/Xs8hd2EiYETqgUklphoYD4J2RxvPwMyqBL15QN6wNg==",
- "dependencies": {
- "@sentry/types": "7.3.0",
- "tslib": "^1.9.3"
- },
- "engines": {
- "node": ">=8"
- }
- },
"node_modules/@sideway/address": {
"version": "4.1.4",
"resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.4.tgz",
@@ -14135,11 +14039,6 @@
"node": ">=8"
}
},
- "node_modules/lru_map": {
- "version": "0.3.3",
- "resolved": "https://registry.npmjs.org/lru_map/-/lru_map-0.3.3.tgz",
- "integrity": "sha512-Pn9cox5CsMYngeDbmChANltQl+5pi6XmTrraMSzhPmMBbmgcxmqWry0U3PGapCU1yB4/LqCcom7qhHZiF/jGfQ=="
- },
"node_modules/lru-cache": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
@@ -25655,78 +25554,6 @@
}
}
},
- "@sentry/browser": {
- "version": "7.3.0",
- "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-7.3.0.tgz",
- "integrity": "sha512-UJMTDbajKNRGrs4ZQNelrPDaATvSZ9uELpPOtPSG6JUvB1BCwGgsgzz55RS0Uqs7B8KhMnDQ0kIn3FMewM4FMg==",
- "requires": {
- "@sentry/core": "7.3.0",
- "@sentry/types": "7.3.0",
- "@sentry/utils": "7.3.0",
- "tslib": "^1.9.3"
- }
- },
- "@sentry/core": {
- "version": "7.3.0",
- "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.3.0.tgz",
- "integrity": "sha512-EvuWVlYm0F0+BtIEmQiCL31Fw0cfKSwUTmxc99wvouaabpHBr2zCJHRxaXOWzxS705bYBJEQiFDTIHfoOQZMzA==",
- "requires": {
- "@sentry/hub": "7.3.0",
- "@sentry/types": "7.3.0",
- "@sentry/utils": "7.3.0",
- "tslib": "^1.9.3"
- }
- },
- "@sentry/hub": {
- "version": "7.3.0",
- "resolved": "https://registry.npmjs.org/@sentry/hub/-/hub-7.3.0.tgz",
- "integrity": "sha512-0GtTaWf/hoAMoIFY7Ke6eozIbG3FdIPM364sER4SxUQVSklp6AORrV6p82IgWPROK6aj83cPk9Bszgi6RiF/BA==",
- "requires": {
- "@sentry/types": "7.3.0",
- "@sentry/utils": "7.3.0",
- "tslib": "^1.9.3"
- }
- },
- "@sentry/node": {
- "version": "7.3.0",
- "resolved": "https://registry.npmjs.org/@sentry/node/-/node-7.3.0.tgz",
- "integrity": "sha512-hPqLQMdpL9MeirtKDCgy0ekptWh58CCUhvcoQ2bYstVBsyMMTNTbiQqF/ClzanrScQ5CEuGWnCbKxrFN/S6cQg==",
- "requires": {
- "@sentry/core": "7.3.0",
- "@sentry/hub": "7.3.0",
- "@sentry/types": "7.3.0",
- "@sentry/utils": "7.3.0",
- "cookie": "^0.4.1",
- "https-proxy-agent": "^5.0.0",
- "lru_map": "^0.3.3",
- "tslib": "^1.9.3"
- }
- },
- "@sentry/tracing": {
- "version": "7.3.0",
- "resolved": "https://registry.npmjs.org/@sentry/tracing/-/tracing-7.3.0.tgz",
- "integrity": "sha512-A+mLEH8jtLkhfyw81EZA1XgI96jh9TIwH9EST3hdfSPgdZQf0A5sV8oVVh/d9Hw7NVb65Va5KhAZDNhcx5QxUA==",
- "requires": {
- "@sentry/hub": "7.3.0",
- "@sentry/types": "7.3.0",
- "@sentry/utils": "7.3.0",
- "tslib": "^1.9.3"
- }
- },
- "@sentry/types": {
- "version": "7.3.0",
- "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.3.0.tgz",
- "integrity": "sha512-cGkHdh9+uvbFTj65TjWcXuhe6vQiMY+U+N2GE5xCfmZT9hwuouCASViNsbJMpZqvCg+Yi0fasQLZ71rujiRNOA=="
- },
- "@sentry/utils": {
- "version": "7.3.0",
- "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.3.0.tgz",
- "integrity": "sha512-xUP8TBf2p/c6CN8eFQ7Y+xk0IFrJXsph5ScozqNl/2l/Xs8hd2EiYETqgUklphoYD4J2RxvPwMyqBL15QN6wNg==",
- "requires": {
- "@sentry/types": "7.3.0",
- "tslib": "^1.9.3"
- }
- },
"@sideway/address": {
"version": "4.1.4",
"resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.4.tgz",
@@ -32939,11 +32766,6 @@
"resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz",
"integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA=="
},
- "lru_map": {
- "version": "0.3.3",
- "resolved": "https://registry.npmjs.org/lru_map/-/lru_map-0.3.3.tgz",
- "integrity": "sha512-Pn9cox5CsMYngeDbmChANltQl+5pi6XmTrraMSzhPmMBbmgcxmqWry0U3PGapCU1yB4/LqCcom7qhHZiF/jGfQ=="
- },
"lru-cache": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
diff --git a/package.json b/package.json
index 1741900..5f0438b 100644
--- a/package.json
+++ b/package.json
@@ -36,9 +36,6 @@
"@remix-run/node": "1.14.3",
"@remix-run/react": "1.14.3",
"@remix-run/server-runtime": "1.14.3",
- "@sentry/browser": "7.3.0",
- "@sentry/node": "7.3.0",
- "@sentry/tracing": "7.3.0",
"@tailwindcss/forms": "0.5.2",
"@tailwindcss/line-clamp": "0.4.0",
"@tailwindcss/typography": "0.5.2",
diff --git a/server/index.ts b/server/index.ts
index 7ac1ced..5834178 100644
--- a/server/index.ts
+++ b/server/index.ts
@@ -2,25 +2,12 @@ import express from "express";
import compression from "compression";
import morgan from "morgan";
import { createRequestHandler } from "@remix-run/express";
-import * as Sentry from "@sentry/node";
-import config from "~/config/config.server";
import logger from "~/utils/logger.server";
import { adminMiddleware, setupBullBoard } from "./queues";
-import { registerSentry, sentryLoadContext } from "./sentry-remix";
import { purgeRequireCache } from "./purge-require-cache";
const environment = process.env.NODE_ENV;
-
-if (config.sentry.dsn) {
- Sentry.init({
- dsn: config.sentry.dsn,
- integrations: [new Sentry.Integrations.Http({ tracing: true })],
- tracesSampleRate: 1.0,
- environment,
- });
-}
-
const app = express();
app.use((req, res, next) => {
res.set("X-Fly-Region", process.env.FLY_REGION ?? "unknown");
@@ -90,9 +77,8 @@ app.all("*", (req, res, next) => {
}
return createRequestHandler({
- build: registerSentry(require("../build")),
+ build: require("../build"),
mode: environment,
- getLoadContext: sentryLoadContext,
})(req, res, next);
});
diff --git a/server/sentry-remix.ts b/server/sentry-remix.ts
deleted file mode 100644
index 5895782..0000000
--- a/server/sentry-remix.ts
+++ /dev/null
@@ -1,109 +0,0 @@
-import type { Request, Response } from "express";
-import type { ActionFunction, DataFunctionArgs, LoaderFunction, ServerBuild } from "@remix-run/node";
-import { isResponse } from "@remix-run/server-runtime/dist/responses";
-import type { Transaction } from "@sentry/types";
-import * as Sentry from "@sentry/node";
-import { v4 as uuid } from "uuid";
-
-import { __getSession } from "~/utils/session.server";
-import type { SessionData } from "~/utils/auth.server";
-
-function wrapDataFunc(func: ActionFunction | LoaderFunction, routeId: string, method: string) {
- const ogFunc = func;
-
- return async (args: DataFunctionArgs) => {
- const session = await __getSession(args.request.headers.get("Cookie"));
- const sessionData: SessionData | undefined = session.data.user;
- if (sessionData) {
- Sentry.setUser({
- id: sessionData.user.id,
- email: sessionData.user.email,
- role: sessionData.user.role,
- });
- } else {
- Sentry.configureScope((scope) => scope.setUser(null));
- }
-
- const parentTransaction: Transaction | undefined = args.context && (args.context.__sentry_transaction as any);
- const transaction = parentTransaction?.startChild({
- op: `${method}:${routeId}`,
- description: `${method}: ${routeId}`,
- });
- if (transaction) {
- transaction.setStatus("ok");
- transaction.transaction = parentTransaction;
- }
-
- try {
- return await ogFunc(args);
- } catch (error) {
- if (isResponse(error)) {
- throw error;
- }
-
- Sentry.captureException(error, {
- tags: {
- global_id: parentTransaction && parentTransaction.tags["global_id"],
- },
- });
- transaction?.setStatus("internal_error");
- throw error;
- } finally {
- transaction?.finish();
- }
- };
-}
-
-// Register Sentry across your entire remix build.
-export function registerSentry(build: ServerBuild) {
- type Route = ServerBuild["routes"][string];
-
- const routes: Record = {};
-
- for (const [id, route] of Object.entries(build.routes)) {
- const newRoute: Route = { ...route, module: { ...route.module } };
-
- if (route.module.action) {
- newRoute.module.action = wrapDataFunc(route.module.action, id, "action");
- }
-
- if (route.module.loader) {
- newRoute.module.loader = wrapDataFunc(route.module.loader, id, "loader");
- }
-
- routes[id] = newRoute;
- }
-
- return {
- ...build,
- routes,
- };
-}
-
-export function sentryLoadContext(req: Request, res: Response) {
- const transaction = Sentry.getCurrentHub().startTransaction({
- op: "request",
- name: `${req.method}: ${req.url}`,
- description: `${req.method}: ${req.url}`,
- metadata: {
- requestPath: req.url,
- },
- tags: {
- global_id: uuid(),
- },
- });
- transaction && transaction.setStatus("internal_error");
-
- res.once("finish", () => {
- if (transaction) {
- transaction.setHttpStatus(res.statusCode);
- transaction.setTag("http.status_code", res.statusCode);
- transaction.setTag("http.method", req.method);
- transaction.finish();
- }
- });
-
- return {
- __sentry_transaction: transaction,
- };
-}