1
1
import { PassThrough } from 'node:stream'
2
+ import { createReadableStreamFromReadable } from '@react-router/node'
3
+
4
+ import * as Sentry from '@sentry/node'
5
+ import chalk from 'chalk'
6
+ import { isbot } from 'isbot'
7
+ import { renderToPipeableStream } from 'react-dom/server'
2
8
import {
3
- createReadableStreamFromReadable ,
9
+ ServerRouter ,
4
10
type LoaderFunctionArgs ,
5
11
type ActionFunctionArgs ,
6
12
type HandleDocumentRequestFunction ,
7
- } from '@remix-run/node'
8
- import { RemixServer } from '@remix-run/react'
9
- import * as Sentry from '@sentry/remix'
10
- import chalk from 'chalk'
11
- import { isbot } from 'isbot'
12
- import { renderToPipeableStream } from 'react-dom/server'
13
+ } from 'react-router'
13
14
import { getEnv , init } from './utils/env.server.ts'
14
15
import { getInstanceInfo } from './utils/litefs.server.ts'
15
16
import { NonceProvider } from './utils/nonce-provider.ts'
16
17
import { makeTimings } from './utils/timing.server.ts'
17
18
18
- const ABORT_DELAY = 5000
19
+ export const streamTimeout = 5000
19
20
20
21
init ( )
21
22
global . ENV = getEnv ( )
@@ -27,7 +28,7 @@ export default async function handleRequest(...args: DocRequestArgs) {
27
28
request ,
28
29
responseStatusCode ,
29
30
responseHeaders ,
30
- remixContext ,
31
+ reactRouterContext ,
31
32
loadContext ,
32
33
] = args
33
34
const { currentInstance, primaryInstance } = await getInstanceInfo ( )
@@ -53,7 +54,11 @@ export default async function handleRequest(...args: DocRequestArgs) {
53
54
54
55
const { pipe, abort } = renderToPipeableStream (
55
56
< NonceProvider value = { nonce } >
56
- < RemixServer context = { remixContext } url = { request . url } />
57
+ < ServerRouter
58
+ nonce = { nonce }
59
+ context = { reactRouterContext }
60
+ url = { request . url }
61
+ />
57
62
</ NonceProvider > ,
58
63
{
59
64
[ callbackName ] : ( ) => {
@@ -78,7 +83,7 @@ export default async function handleRequest(...args: DocRequestArgs) {
78
83
} ,
79
84
)
80
85
81
- setTimeout ( abort , ABORT_DELAY )
86
+ setTimeout ( abort , streamTimeout + 5000 )
82
87
} )
83
88
}
84
89
@@ -103,12 +108,7 @@ export function handleError(
103
108
}
104
109
if ( error instanceof Error ) {
105
110
console . error ( chalk . red ( error . stack ) )
106
- void Sentry . captureRemixServerException (
107
- error ,
108
- 'remix.server' ,
109
- request ,
110
- true ,
111
- )
111
+ void Sentry . captureException ( error )
112
112
} else {
113
113
console . error ( error )
114
114
Sentry . captureException ( error )
0 commit comments