Skip to content

Commit 364a03a

Browse files
committed
WIP
1 parent f811fa3 commit 364a03a

File tree

7 files changed

+34
-20
lines changed

7 files changed

+34
-20
lines changed

dev-packages/e2e-tests/test-applications/create-remix-app-v2-legacy/app/entry.server.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,9 @@ installGlobals();
2626

2727
const ABORT_DELAY = 5_000;
2828

29-
const handleErrorImpl = () => {
29+
export const handleError = Sentry.wrapHandleErrorWithSentry(() => {
3030
Sentry.setTag('remix-test-tag', 'remix-test-value');
31-
};
32-
33-
export const handleError = Sentry.wrapHandleErrorWithSentry(handleErrorImpl);
31+
});
3432

3533
export default function handleRequest(
3634
request: Request,

dev-packages/e2e-tests/test-applications/remix-hydrogen/app/entry.server.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
import * as Sentry from '@sentry/remix';
1+
// import * as Sentry from '@sentry/remix';
22

3-
import { RemixServer } from '@remix-run/react';
4-
import { createContentSecurityPolicy } from '@shopify/hydrogen';
5-
import type { DataFunctionArgs, EntryContext } from '@shopify/remix-oxygen';
3+
import {RemixServer} from '@remix-run/react';
4+
import {createContentSecurityPolicy} from '@shopify/hydrogen';
5+
import type {EntryContext} from '@shopify/remix-oxygen';
66
import isbot from 'isbot';
7-
import { renderToReadableStream } from 'react-dom/server';
7+
import {renderToReadableStream} from 'react-dom/server';
88

9-
export async function handleError(error: unknown, { request }: DataFunctionArgs): Promise<void> {
10-
Sentry.captureRemixServerException(error, 'remix.server', request, true);
11-
}
9+
// export async function handleError(error: unknown, { request }: DataFunctionArgs): Promise<void> {
10+
// Sentry.captureRemixServerException(error, 'remix.server', request, true);
11+
// }
1212

1313
export default async function handleRequest(
1414
request: Request,
1515
responseStatusCode: number,
1616
responseHeaders: Headers,
1717
remixContext: EntryContext,
1818
) {
19-
const { nonce, header, NonceProvider } = createContentSecurityPolicy();
19+
const {nonce, header, NonceProvider} = createContentSecurityPolicy();
2020

2121
const body = await renderToReadableStream(
2222
<NonceProvider>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { createPagesFunctionHandler } from '@remix-run/cloudflare-pages';
2+
import { sentryPagesPlugin } from '@sentry/cloudflare';
3+
4+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
5+
// @ts-ignore - the server build file is generated by `remix vite:build`
6+
// eslint-disable-next-line import/no-unresolved
7+
import * as build from '../build/server';
8+
9+
export const onRequest = [
10+
context => sentryPagesPlugin({ dsn: context.env.E2E_TEST_DSN, tracesSampleRate: 1.0 })(context),
11+
createPagesFunctionHandler({ build }),
12+
];

dev-packages/e2e-tests/test-applications/remix-hydrogen/app/root.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {type LoaderArgs, defer} from '@shopify/remix-oxygen';
1919
import favicon from '../public/favicon.svg';
2020
import type {HydrogenSession} from '../server';
2121

22-
import * as Sentry from '@sentry/remix';
22+
import {captureRemixErrorBoundaryError} from '@sentry/remix';
2323

2424
// This is important to avoid re-fetching root queries on sub-navigations
2525
export const shouldRevalidate: ShouldRevalidateFunction = ({
@@ -142,8 +142,8 @@ function App() {
142142
);
143143
}
144144

145-
// export default Sentry.withSentry(App);
146145
export default App;
146+
// export default withSentry(App);
147147

148148
export function ErrorBoundary() {
149149
const error = useRouteError();
@@ -152,8 +152,8 @@ export function ErrorBoundary() {
152152
let errorMessage = 'Unknown error';
153153
let errorStatus = 500;
154154

155-
// // Send the error to Sentry
156-
// const eventId = Sentry.captureRemixErrorBoundaryError(error);
155+
// Send the error to Sentry
156+
const eventId = captureRemixErrorBoundaryError(error);
157157

158158
if (isRouteErrorResponse(error)) {
159159
errorMessage = error?.data?.message ?? error.data;

dev-packages/e2e-tests/test-applications/remix-hydrogen/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"type": "module",
55
"scripts": {
66
"build": "shopify hydrogen build",
7-
"dev": "NODE_OPTIONS='--import ./instrument.server.mjs' shopify hydrogen dev",
8-
"start": "NODE_OPTIONS='--import ./instrument.server.mjs' shopify hydrogen preview --build --verbose --debug",
7+
"dev": "shopify hydrogen dev",
8+
"start": "shopify hydrogen preview --build --verbose",
99
"lint": "eslint --no-error-on-unmatched-pattern --ext .js,.ts,.jsx,.tsx .",
1010
"typecheck": "tsc --noEmit",
1111
"codegen": "shopify hydrogen codegen",
@@ -18,6 +18,7 @@
1818
"@remix-run/react": "2.9.2",
1919
"@remix-run/server-runtime": "^2.9.2",
2020
"@sentry/remix": "latest || *",
21+
"@sentry/cloudflare": "latest || *",
2122
"@shopify/cli": "3.60.0",
2223
"@shopify/cli-hydrogen": "^8.1.1",
2324
"@shopify/hydrogen": "2024.4.7",
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import { getPlaywrightConfig } from '@sentry-internal/test-utils';
1+
import {getPlaywrightConfig} from '@sentry-internal/test-utils';
22

33
const config = getPlaywrightConfig({
44
startCommand: `pnpm run start`,
5+
port: 3000,
56
});
67

78
export default config;

dev-packages/e2e-tests/test-applications/remix-hydrogen/server.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// import './instrument.server.mjs';
2+
13
import {
24
cartGetIdDefault,
35
cartSetIdDefault,

0 commit comments

Comments
 (0)