Skip to content

fix: handle invalid source map columns in Bun runtime#13

Open
deepshekhardas wants to merge 1 commit into
mainfrom
fix/3049-bun-sourcemap
Open

fix: handle invalid source map columns in Bun runtime#13
deepshekhardas wants to merge 1 commit into
mainfrom
fix/3049-bun-sourcemap

Conversation

@deepshekhardas
Copy link
Copy Markdown
Owner

@deepshekhardas deepshekhardas commented May 24, 2026

Bun's runtime can produce source maps with column values of -1, which causes source-map@0.6.1 (used by source-map-support) to throw: "Column must be greater than or equal to 0, got -1"

This change extracts source-map-support installation into a shared utility that wraps prepareStackTrace so that if source map processing fails, it falls back to default stack trace formatting instead of crashing.

Closes triggerdotdev#3049


Summary by cubic

Prevents crashes in Bun caused by invalid -1 source map columns by installing source-map-support with a safe prepareStackTrace fallback. Also tightens task registration during execution and aligns workers to use the new utility. Closes triggerdotdev#3049.

  • Bug Fixes
    • Added installSourceMapSupport() to wrap prepareStackTrace; on source map errors, fall back to default formatting instead of throwing.
    • Updated all v3 run/index workers to import ../utilities/installSourceMapSupport.js.
    • Set a sentinel NO_FILE_CONTEXT during execution so task() calls in run/lifecycle hooks aren’t dropped; cleared after run.
    • Corrected resourceCatalog.setCurrentFileContext(...) argument order when loading tasks.

Written for commit 10f2e9d. Summary will update on new commits. Review in cubic

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 5 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/cli-v3/src/utilities/installSourceMapSupport.ts">

<violation number="1" location="packages/cli-v3/src/utilities/installSourceMapSupport.ts:16">
P2: This always installs source-map-support and drops existing `TRIGGER_SOURCE_MAPS` runtime controls (`false`, `0`, `node`), which changes configured behavior in worker entrypoints.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

* See: https://github.com/oven-sh/bun/issues/8087
*/
export function installSourceMapSupport() {
sourceMapSupport.install({
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: This always installs source-map-support and drops existing TRIGGER_SOURCE_MAPS runtime controls (false, 0, node), which changes configured behavior in worker entrypoints.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/cli-v3/src/utilities/installSourceMapSupport.ts, line 16:

<comment>This always installs source-map-support and drops existing `TRIGGER_SOURCE_MAPS` runtime controls (`false`, `0`, `node`), which changes configured behavior in worker entrypoints.</comment>

<file context>
@@ -0,0 +1,32 @@
+ * See: https://github.com/oven-sh/bun/issues/8087
+ */
+export function installSourceMapSupport() {
+  sourceMapSupport.install({
+    handleUncaughtExceptions: false,
+    environment: "node",
</file context>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant