-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathentry.server.tsx
More file actions
26 lines (21 loc) · 816 Bytes
/
entry.server.tsx
File metadata and controls
26 lines (21 loc) · 816 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { createReadableStreamFromReadable } from '@react-router/node';
import * as Sentry from '@sentry/react-router';
import { renderToPipeableStream } from 'react-dom/server';
import { ServerRouter } from 'react-router';
import { type HandleErrorFunction } from 'react-router';
const ABORT_DELAY = 5_000;
const handleRequest = Sentry.createSentryHandleRequest({
streamTimeout: ABORT_DELAY,
ServerRouter,
renderToPipeableStream,
createReadableStreamFromReadable,
});
export default handleRequest;
export const handleError: HandleErrorFunction = (error, { request }) => {
// React Router may abort some interrupted requests, don't log those
if (!request.signal.aborted) {
Sentry.captureException(error);
// make sure to still log the error so you can see it
console.error(error);
}
};