Skip to content

Commit a43a41e

Browse files
committed
Clean up
1 parent 0ef2300 commit a43a41e

File tree

7 files changed

+30
-32
lines changed

7 files changed

+30
-32
lines changed

packages/e2e-tests/Dockerfile.publish-packages

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This Dockerfile exists for the purpose of using a specific node/npm version (ie. the same we use in CI) to run npm publish with
2-
ARG NODE_VERSION=18.17.0
2+
ARG NODE_VERSION=16.19.0
33
FROM node:${NODE_VERSION}
44

55
WORKDIR /sentry-javascript/packages/e2e-tests

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

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import { PassThrough } from 'node:stream';
88

9-
import type { AppLoadContext, EntryContext } from '@remix-run/node';
9+
import type { AppLoadContext, EntryContext, DataFunctionArgs } from '@remix-run/node';
1010
import { Response } from '@remix-run/node';
1111
import { RemixServer } from '@remix-run/react';
1212
import isbot from 'isbot';
@@ -22,6 +22,14 @@ Sentry.init({
2222
isRemixV2: true,
2323
});
2424

25+
export function handleError(error: unknown, { request }: DataFunctionArgs): void {
26+
if (error instanceof Error) {
27+
Sentry.captureRemixServerException(error, 'remix.server', request);
28+
} else {
29+
Sentry.captureException(error);
30+
}
31+
}
32+
2533
export default function handleRequest(
2634
request: Request,
2735
responseStatusCode: number,
@@ -41,12 +49,10 @@ function handleBotRequest(
4149
remixContext: EntryContext,
4250
) {
4351
return new Promise((resolve, reject) => {
44-
let shellRendered = false;
4552
const { pipe, abort } = renderToPipeableStream(
4653
<RemixServer context={remixContext} url={request.url} abortDelay={ABORT_DELAY} />,
4754
{
4855
onAllReady() {
49-
shellRendered = true;
5056
const body = new PassThrough();
5157

5258
responseHeaders.set('Content-Type', 'text/html');
@@ -65,12 +71,7 @@ function handleBotRequest(
6571
},
6672
onError(error: unknown) {
6773
responseStatusCode = 500;
68-
// Log streaming rendering errors from inside the shell. Don't log
69-
// errors encountered during initial shell rendering since they'll
70-
// reject and get logged in handleDocumentRequest.
71-
if (shellRendered) {
72-
console.error(error);
73-
}
74+
console.error(error);
7475
},
7576
},
7677
);
@@ -86,12 +87,10 @@ function handleBrowserRequest(
8687
remixContext: EntryContext,
8788
) {
8889
return new Promise((resolve, reject) => {
89-
let shellRendered = false;
9090
const { pipe, abort } = renderToPipeableStream(
9191
<RemixServer context={remixContext} url={request.url} abortDelay={ABORT_DELAY} />,
9292
{
9393
onShellReady() {
94-
shellRendered = true;
9594
const body = new PassThrough();
9695

9796
responseHeaders.set('Content-Type', 'text/html');
@@ -109,13 +108,8 @@ function handleBrowserRequest(
109108
reject(error);
110109
},
111110
onError(error: unknown) {
111+
console.error(error);
112112
responseStatusCode = 500;
113-
// Log streaming rendering errors from inside the shell. Don't log
114-
// errors encountered during initial shell rendering since they'll
115-
// reject and get logged in handleDocumentRequest.
116-
if (shellRendered) {
117-
console.error(error);
118-
}
119113
},
120114
},
121115
);

packages/e2e-tests/test-applications/create-remix-app-v2/app/root.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ export const loader = () => {
2222
});
2323
};
2424

25-
export const ErrorBoundary = () => {
26-
const error = useRouteError() as { eventId?: string | Promise<string> | undefined };
25+
export function ErrorBoundary() {
26+
const error = useRouteError();
2727
const eventId = captureRemixErrorBoundaryError(error);
2828

2929
return (
@@ -32,7 +32,7 @@ export const ErrorBoundary = () => {
3232
<span id="event-id">{eventId}</span>
3333
</div>
3434
);
35-
};
35+
}
3636

3737
function App() {
3838
const { ENV } = useLoaderData();

packages/e2e-tests/test-applications/create-remix-app-v2/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"scripts": {
55
"build": "remix build",
66
"dev": "remix dev",
7-
"start": "remix dev -c \"remix-serve ./build/index.js\"",
7+
"start": "remix-serve build/index.js",
88
"typecheck": "tsc",
99
"clean": "npx rimraf node_modules,pnpm-lock.yaml",
1010
"test:build": "pnpm install && npx playwright install && pnpm build",
@@ -27,7 +27,7 @@
2727
"@types/react": "^18.0.35",
2828
"@types/react-dom": "^18.0.11",
2929
"eslint": "^8.38.0",
30-
"typescript": "^5.1.0"
30+
"typescript": "^5.0.4"
3131
},
3232
"engines": {
3333
"node": ">=18.0.0"
Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
/** @type {import('@remix-run/dev').AppConfig} */
22
module.exports = {
33
ignoredRouteFiles: ['**/.*'],
4-
appDirectory: 'app',
5-
assetsBuildDirectory: 'public/build',
6-
serverBuildPath: 'build/index.js',
7-
publicPath: '/build/',
4+
// appDirectory: 'app',
5+
// assetsBuildDirectory: 'public/build',
6+
// serverBuildPath: 'build/index.js',
7+
// publicPath: '/build/',
88
serverModuleFormat: 'cjs',
9+
future: {
10+
v2_dev: true,
11+
v2_headers: true,
12+
v2_errorBoundary: true,
13+
v2_meta: true,
14+
v2_normalizeFormMethod: true,
15+
v2_routeConvention: true,
16+
},
917
};

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,8 @@ Sentry.init({
2323

2424
export function handleError(error: unknown, { request }: DataFunctionArgs): void {
2525
if (error instanceof Error) {
26-
// @ts-ignore
27-
// Injecting the event ID into the error context allows us to reference it for E2E testing
2826
Sentry.captureRemixServerException(error, 'remix.server', request);
2927
} else {
30-
// @ts-ignore
31-
// Injecting the event ID into the error context allows us to reference it for E2E testing
3228
Sentry.captureException(error);
3329
}
3430
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const loader = () => {
2323
};
2424

2525
export function ErrorBoundary() {
26-
const error = useRouteError() as { eventId?: string | Promise<string> | undefined };
26+
const error = useRouteError();
2727
const eventId = captureRemixErrorBoundaryError(error);
2828

2929
return (

0 commit comments

Comments
 (0)