Skip to content

Commit 0642cbe

Browse files
committed
Enhance Sentry initialization with session tools and Dapper client integration
1 parent 6d4afee commit 0642cbe

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

apps/cyberstorm-remix/app/entry.client.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,20 @@ import { hydrateRoot } from "react-dom/client";
44
import { useLocation, useMatches } from "react-router";
55
import { HydratedRouter } from "react-router/dom";
66

7-
import { getPublicEnvVariables } from "cyberstorm/security/publicEnvVariables";
7+
import {
8+
getPublicEnvVariables,
9+
getSessionTools,
10+
} from "cyberstorm/security/publicEnvVariables";
811
import { denyUrls } from "cyberstorm/utils/sentry";
12+
import { initializeClientDapper } from "cyberstorm/utils/dapperSingleton";
913

1014
const publicEnvVariables = getPublicEnvVariables([
1115
"VITE_SITE_URL",
1216
"VITE_BETA_SITE_URL",
1317
"VITE_API_URL",
1418
"VITE_AUTH_BASE_URL",
1519
"VITE_CLIENT_SENTRY_DSN",
20+
"VITE_COOKIE_DOMAIN",
1621
]);
1722

1823
Sentry.init({
@@ -69,6 +74,16 @@ Sentry.init({
6974
denyUrls,
7075
});
7176

77+
try {
78+
const sessionTools = getSessionTools();
79+
80+
initializeClientDapper(() =>
81+
sessionTools.getConfig(publicEnvVariables.VITE_API_URL)
82+
);
83+
} catch (error) {
84+
Sentry.captureException(error);
85+
}
86+
7287
startTransition(() => {
7388
hydrateRoot(
7489
document,

apps/cyberstorm-remix/cyberstorm/security/publicEnvVariables.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { getSessionContext } from "@thunderstore/ts-api-react/src/SessionContext";
2-
import { isRecord } from "cyberstorm/utils/typeChecks";
2+
import { isRecord } from "../utils/typeChecks";
33

44
export type publicEnvVariablesKeys =
55
| "SITE_URL"
@@ -57,7 +57,7 @@ export function getSessionTools() {
5757
!publicEnvVariables.VITE_COOKIE_DOMAIN
5858
) {
5959
throw new Error(
60-
"Enviroment variables did not load correctly, please hard refresh page"
60+
"Environment variables did not load correctly, please hard refresh page"
6161
);
6262
}
6363
return getSessionContext(

0 commit comments

Comments
 (0)