File tree Expand file tree Collapse file tree 2 files changed +12
-10
lines changed Expand file tree Collapse file tree 2 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -18,14 +18,6 @@ sourceMapSupport.install({
1818 } ,
1919} )
2020
21- closeWithGrace ( async ( { err } ) => {
22- if ( err ) {
23- console . error ( chalk . red ( err ) )
24- console . error ( chalk . red ( err . stack ) )
25- process . exit ( 1 )
26- }
27- } )
28-
2921if ( process . env . MOCKS === 'true' ) {
3022 await import ( './tests/mocks/index.ts' )
3123}
Original file line number Diff line number Diff line change 11import crypto from 'node:crypto'
22import { createRequestHandler } from '@remix-run/express'
33import { type ServerBuild } from '@remix-run/node'
4+ import Sentry from '@sentry/remix'
45import { ip as ipAddress } from 'address'
56import chalk from 'chalk'
67import closeWithGrace from 'close-with-grace'
@@ -15,8 +16,9 @@ const MODE = process.env.NODE_ENV ?? 'development'
1516const IS_PROD = MODE === 'production'
1617const IS_DEV = MODE === 'development'
1718const ALLOW_INDEXING = process . env . ALLOW_INDEXING !== 'false'
19+ const SENTRY_ENABLED = IS_PROD && process . env . SENTRY_DSN
1820
19- if ( IS_PROD && process . env . SENTRY_DSN ) {
21+ if ( SENTRY_ENABLED ) {
2022 void import ( './utils/monitoring.js' ) . then ( ( { init } ) => init ( ) )
2123}
2224
@@ -276,8 +278,16 @@ ${chalk.bold('Press Ctrl+C to stop')}
276278 )
277279} )
278280
279- closeWithGrace ( async ( ) => {
281+ closeWithGrace ( async ( { err } ) => {
280282 await new Promise ( ( resolve , reject ) => {
281283 server . close ( ( e ) => ( e ? reject ( e ) : resolve ( 'ok' ) ) )
282284 } )
285+ if ( err ) {
286+ console . error ( chalk . red ( err ) )
287+ console . error ( chalk . red ( err . stack ) )
288+ if ( SENTRY_ENABLED ) {
289+ Sentry . captureException ( err )
290+ await Sentry . flush ( 500 )
291+ }
292+ }
283293} )
You can’t perform that action at this time.
0 commit comments