Skip to content

Commit abe25e3

Browse files
committed
Read DSNs from env.ts on client-side.
1 parent 3bc6ff5 commit abe25e3

File tree

5 files changed

+6
-37
lines changed

5 files changed

+6
-37
lines changed

packages/e2e-tests/test-applications/remix-cloudflare-pages/app/entry.client.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ import { RemixBrowser, useLocation, useMatches } from '@remix-run/react';
88
import { startTransition, StrictMode, useEffect } from 'react';
99
import { hydrateRoot } from 'react-dom/client';
1010
import * as Sentry from '@sentry/remix';
11+
import { env } from '../env';
1112

1213
Sentry.init({
13-
dsn: window.ENV.SENTRY_DSN,
14+
dsn: env.SENTRY_DSN,
1415
integrations: [
1516
new Sentry.BrowserTracing({
1617
routingInstrumentation: Sentry.remixRouterInstrumentation(useEffect, useLocation, useMatches),

packages/e2e-tests/test-applications/remix-cloudflare-pages/app/root.tsx

+1-17
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,16 @@
1-
import { json, LinksFunction } from '@remix-run/cloudflare';
1+
import { LinksFunction } from '@remix-run/cloudflare';
22
import { cssBundleHref } from '@remix-run/css-bundle';
33
import { Links, LiveReload, Meta, Outlet, Scripts, ScrollRestoration, useLoaderData } from '@remix-run/react';
44
import { withSentry } from '@sentry/remix';
5-
import { env } from '../env';
65

76
export const links: LinksFunction = () => [...(cssBundleHref ? [{ rel: 'stylesheet', href: cssBundleHref }] : [])];
87

9-
export const loader = () => {
10-
return json({
11-
ENV: {
12-
SENTRY_DSN: env.SENTRY_DSN,
13-
},
14-
});
15-
};
16-
178
function App() {
18-
const { ENV } = useLoaderData();
19-
209
return (
2110
<html lang="en">
2211
<head>
2312
<meta charSet="utf-8" />
2413
<meta name="viewport" content="width=device-width, initial-scale=1" />
25-
<script
26-
dangerouslySetInnerHTML={{
27-
__html: `window.ENV = ${JSON.stringify(ENV)}`,
28-
}}
29-
/>
3014
<Meta />
3115
<Links />
3216
</head>

packages/e2e-tests/test-applications/remix-cloudflare-workers/app/entry.client.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ import { RemixBrowser, useLocation, useMatches } from '@remix-run/react';
88
import { startTransition, StrictMode, useEffect } from 'react';
99
import { hydrateRoot } from 'react-dom/client';
1010
import * as Sentry from '@sentry/remix';
11+
import { env } from '../env';
1112

1213
Sentry.init({
13-
dsn: window.ENV.SENTRY_DSN,
14+
dsn: env.SENTRY_DSN,
1415
integrations: [
1516
new Sentry.BrowserTracing({
1617
routingInstrumentation: Sentry.remixRouterInstrumentation(useEffect, useLocation, useMatches),

packages/e2e-tests/test-applications/remix-cloudflare-workers/app/entry.server.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ Sentry.workerInit({
1515
dsn: env.SENTRY_DSN,
1616
// Performance Monitoring
1717
tracesSampleRate: 1.0, // Capture 100% of the transactions, reduce in production!
18-
debug: true,
1918
});
2019

2120
export function handleError(error: unknown, { request }: DataFunctionArgs): void {

packages/e2e-tests/test-applications/remix-cloudflare-workers/app/root.tsx

+1-17
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,16 @@
1-
import { json, LinksFunction } from '@remix-run/cloudflare';
1+
import { LinksFunction } from '@remix-run/cloudflare';
22
import { cssBundleHref } from '@remix-run/css-bundle';
33
import { Links, LiveReload, Meta, Outlet, Scripts, ScrollRestoration, useLoaderData } from '@remix-run/react';
44
import { withSentry } from '@sentry/remix';
5-
import { env } from '../env';
65

76
export const links: LinksFunction = () => [...(cssBundleHref ? [{ rel: 'stylesheet', href: cssBundleHref }] : [])];
87

9-
export const loader = () => {
10-
return json({
11-
ENV: {
12-
SENTRY_DSN: env.SENTRY_DSN,
13-
},
14-
});
15-
};
16-
178
function App() {
18-
const { ENV } = useLoaderData();
19-
209
return (
2110
<html lang="en">
2211
<head>
2312
<meta charSet="utf-8" />
2413
<meta name="viewport" content="width=device-width, initial-scale=1" />
25-
<script
26-
dangerouslySetInnerHTML={{
27-
__html: `window.ENV = ${JSON.stringify(ENV)}`,
28-
}}
29-
/>
3014
<Meta />
3115
<Links />
3216
</head>

0 commit comments

Comments
 (0)