Skip to content

Commit 9c985ee

Browse files
committed
Set projectRoot to null explicitly
This is important because if we don't send it explicitly and just leave it out, it defaults to the current working directory. Generally speaking, this will result in all stack frames from the CLI being identified as outside of the project, preventing correct error grouping in Observe. By setting an explicit null project root, we prevent the SDK-side assignment of in-project state, and we fall back to Observe's much smarter algorithm for identifying in-project lines. For context, see https://github.com/bugsnag/bugsnag-js/blob/286caed5daae9349be8fb22ab0051204bfc1a813/packages/plugin-node-in-project/in-project.js
1 parent 8df2b2d commit 9c985ee

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/cli-kit/src/public/node/error-handler.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,5 +283,10 @@ function initializeBugsnag() {
283283
notify: 'https://error-analytics-production.shopifysvc.com',
284284
sessions: 'https://error-analytics-sessions-production.shopifysvc.com',
285285
},
286+
// Set the project root to `null` to prevent the default behavior of
287+
// Bugsnag which is to set it to the cwd. That is unhelpful for us because
288+
// the cwd can be anywhere in the user's filesystem, not necessarily
289+
// related to the CLI codebase.
290+
projectRoot: null,
286291
})
287292
}

0 commit comments

Comments
 (0)