Skip to content

Vercel builds fail with @sentry/react-router v10: Error: EMFILE: too many open files #17290

@GxDesign

Description

@GxDesign

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/react-router

SDK Version

10.0.0

Framework Version

7.6.3

Link to Sentry event

No response

Reproduction Example/SDK Setup

from monitoring file imported and initialized in entry.server.tsx

	Sentry.init({
		dsn: ENV.SENTRY_DSN,
		environment: ENV.TARGET_ENV,
		tracesSampleRate: ENV.MODE === 'production' ? 1 : 0,
		integrations: [Sentry.httpIntegration()],
		_experiments: { enableLogs: true },
	})

Im using export default wrapSentryHandleRequest(handleRequest) , my handleRequest is almost the same as fresh, just with a nonce provider

<NonceProvider value={nonce}>
	<ServerRouter
		nonce={nonce}
		context={reactRouterContext}
		url={request.url}
	/>
</NonceProvider>,

In my entry.client.tsx:

Sentry.init({
		dsn: ENV.SENTRY_DSN,
		environment: ENV.TARGET_ENV,
		replaysSessionSampleRate: 0.1,
		replaysOnErrorSampleRate: 1.0,
		sendDefaultPii: true,
		beforeSend(event: any) {
			if (event.request?.url) {
				const url = new URL(event.request.url)
				if (
					url.protocol === 'chrome-extension:' ||
					url.protocol === 'moz-extension:'
				) {
					// This error is from a browser extension, ignore it
					return null
				}
			}
			return event
		},
		integrations: [
			Sentry.reactRouterTracingIntegration(),
			Sentry.replayIntegration({
				maskAllText: false,
				blockAllMedia: false,
			}),
			Sentry.browserProfilingIntegration(),
		],
		_experiments: { enableLogs: true },
	})

Additional related dependencies:
"@vercel/react-router": "^1.1.2"
"@react-router/node": "^7.6.3",
"@react-router/serve": "^7.6.3"

Downgrading Sentry to my previous version, 9.32.0, works

Steps to Reproduce

  1. Setup Sentry monitoring with httpIntegration and
  2. Upgraded from 9.32.0 to 10.0.0
  3. Deployed to Vercel, builds passed

Expected Result

No crash

Actual Result

Deployed page (preview) crashes with the following logs:

Error: EMFILE: too many open files, open '/var/task/node_modules/extend/index.js'
    at Object.openSync (node:fs:562:18)
    at readFileSync (node:fs:446:35)
    at getSourceSync (node:internal/modules/esm/load:66:14)
    at getSource (node:internal/modules/esm/translators:68:10)
    at createCJSModuleWrap (node:internal/modules/esm/translators:185:32)
    at ModuleLoader.commonjsStrategy (node:internal/modules/esm/translators:275:10)
    at #translate (node:internal/modules/esm/loader:534:12)
    at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:581:27) {
  errno: -24,
  code: 'EMFILE',
  syscall: 'open',
  path: '/var/task/node_modules/extend/index.js'
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Waiting for: Community

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions