-
-
Notifications
You must be signed in to change notification settings - Fork 971
fix: defer source-map-support loading to prevent OOM with Sentry debug injection #2921
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: defer source-map-support loading to prevent OOM with Sentry debug injection #2921
Conversation
|
WalkthroughThis pull request refactors source-map-support initialization across four entry point files in the CLI package from eager, top-level installation to lazy, deferred installation. Each entry point now includes an installSourceMapSupport() function that dynamically imports source-map-support at runtime with error handling, guarded by a flag to prevent duplicate installations. Installation is deferred until after configuration is loaded and only executed if config.sourceMapSupport is not explicitly false. A new optional sourceMapSupport boolean property is added to TriggerConfig to provide explicit control over this behavior, defaulting to true with a note about potential OOM issues in large projects using Sentry's debug ID injection. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
📜 Recent review detailsConfiguration used: Repository UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (5)
🧰 Additional context used📓 Path-based instructions (6)**/*.{ts,tsx}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
{packages/core,apps/webapp}/**/*.{ts,tsx}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
**/*.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
**/*.ts📄 CodeRabbit inference engine (.cursor/rules/otel-metrics.mdc)
Files:
**/*.{js,ts,jsx,tsx,json,md,yaml,yml}📄 CodeRabbit inference engine (AGENTS.md)
Files:
{packages,integrations}/**/*📄 CodeRabbit inference engine (CLAUDE.md)
Files:
🧠 Learnings (14)📚 Learning: 2025-11-27T16:27:35.304ZApplied to files:
📚 Learning: 2025-11-27T16:27:35.304ZApplied to files:
📚 Learning: 2025-11-27T16:27:35.304ZApplied to files:
📚 Learning: 2025-11-27T16:27:35.304ZApplied to files:
📚 Learning: 2025-11-27T16:27:35.304ZApplied to files:
📚 Learning: 2025-11-27T16:27:35.304ZApplied to files:
📚 Learning: 2025-11-27T16:27:35.304ZApplied to files:
📚 Learning: 2025-11-27T16:27:35.304ZApplied to files:
📚 Learning: 2025-11-27T16:27:35.304ZApplied to files:
📚 Learning: 2025-11-27T16:27:35.304ZApplied to files:
📚 Learning: 2025-11-27T16:26:58.661ZApplied to files:
📚 Learning: 2026-01-15T11:50:06.067ZApplied to files:
📚 Learning: 2026-01-15T11:50:06.067ZApplied to files:
📚 Learning: 2025-11-26T14:40:07.146ZApplied to files:
🔇 Additional comments (9)
✏️ Tip: You can disable this entire section by setting Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Review CompleteYour review story is ready! Comment !reviewfast on this PR to re-generate the story. |
Description
Fixes #2920 - Prevents OOM crashes when using Sentry's debug ID injection with large projects on small machines.
Problem
new Error().stackinto all.mjsfilessource-map-supporteagerly parses all sourcemaps during module loadingsmall-1x(0.5GB RAM)Solution
source-map-supportinstallation until after config loadssourceMapSupportconfig option (default: true) to allow disablingChanges
packages/cli-v3/src/entryPoints/dev-index-worker.ts- Deferred loadingpackages/cli-v3/src/entryPoints/dev-run-worker.ts- Deferred loadingpackages/cli-v3/src/entryPoints/managed-index-worker.ts- Deferred loadingpackages/cli-v3/src/entryPoints/managed-run-worker.ts- Deferred loadingpackages/core/src/v3/config.ts- NewsourceMapSupportoption