Skip to content

Commit 8d1c924

Browse files
committed
fix(react-router): Ensure source map upload fails if Sentry CLI fails
1 parent 93b1c6f commit 8d1c924

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

packages/react-router/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"@opentelemetry/instrumentation": "^0.203.0",
4040
"@opentelemetry/semantic-conventions": "^1.34.0",
4141
"@sentry/browser": "9.40.0",
42-
"@sentry/cli": "^2.46.0",
42+
"@sentry/cli": "^2.49.0",
4343
"@sentry/core": "9.40.0",
4444
"@sentry/node": "9.40.0",
4545
"@sentry/react": "9.40.0",

packages/react-router/src/vite/buildEnd/handleOnBuildEnd.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,12 @@ export const sentryOnBuildEnd: BuildEndHook = async ({ reactRouterConfig, viteCo
5959
if (sourceMapsUploadOptions?.enabled ?? (true && viteConfig.build.sourcemap !== false)) {
6060
// inject debugIds
6161
try {
62-
await cliInstance.execute(['sourcemaps', 'inject', reactRouterConfig.buildDirectory], debug);
62+
await cliInstance.execute(
63+
['sourcemaps', 'inject', reactRouterConfig.buildDirectory],
64+
// @ts-expect-error - 'rejectOnError' is not yet exported as a type from @sentry/cli. It is valid though.
65+
// TODO: update to @sentry/[email protected] once the fix is released: https://github.com/getsentry/sentry-cli/pull/2628
66+
debug ? 'rejectOnError' : false,
67+
);
6368
} catch (error) {
6469
// eslint-disable-next-line no-console
6570
console.error('[Sentry] Could not inject debug ids', error);
@@ -73,6 +78,7 @@ export const sentryOnBuildEnd: BuildEndHook = async ({ reactRouterConfig, viteCo
7378
paths: [reactRouterConfig.buildDirectory],
7479
},
7580
],
81+
live: 'rejectOnError',
7682
});
7783
} catch (error) {
7884
// eslint-disable-next-line no-console

yarn.lock

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7090,7 +7090,7 @@
70907090
"@sentry/cli-win32-i686" "2.42.2"
70917091
"@sentry/cli-win32-x64" "2.42.2"
70927092

7093-
"@sentry/cli@^2.36.1", "@sentry/cli@^2.46.0", "@sentry/cli@^2.50.0":
7093+
"@sentry/cli@^2.36.1", "@sentry/cli@^2.50.0":
70947094
version "2.50.0"
70957095
resolved "https://registry.yarnpkg.com/@sentry/cli/-/cli-2.50.0.tgz#7e2298bea9a2bb50126bfb24116ae98199bc1f6f"
70967096
integrity sha512-OHRRQPUNjBpzOT6arNhxXQ71DKs5jSziCfDzmEGwAs+K8J/I1QxnvJkto88HbXE54oiWhSEJwL0pvcowFXyVbA==
@@ -7110,6 +7110,26 @@
71107110
"@sentry/cli-win32-i686" "2.50.0"
71117111
"@sentry/cli-win32-x64" "2.50.0"
71127112

7113+
"@sentry/cli@^2.49.0":
7114+
version "2.49.0"
7115+
resolved "https://registry.yarnpkg.com/@sentry/cli/-/cli-2.49.0.tgz#a8332ae38e9f92a0da3d939bdbce119e63450e99"
7116+
integrity sha512-99IKax3yjOaPlWJh3rAJC/R6hdmZZJ2B3ACVP8CpOYE+JzGGLyir1fvTzrdFKFLPLOq2lGC3RqWuKqU7PJUTZQ==
7117+
dependencies:
7118+
https-proxy-agent "^5.0.0"
7119+
node-fetch "^2.6.7"
7120+
progress "^2.0.3"
7121+
proxy-from-env "^1.1.0"
7122+
which "^2.0.2"
7123+
optionalDependencies:
7124+
"@sentry/cli-darwin" "2.49.0"
7125+
"@sentry/cli-linux-arm" "2.49.0"
7126+
"@sentry/cli-linux-arm64" "2.49.0"
7127+
"@sentry/cli-linux-i686" "2.49.0"
7128+
"@sentry/cli-linux-x64" "2.49.0"
7129+
"@sentry/cli-win32-arm64" "2.49.0"
7130+
"@sentry/cli-win32-i686" "2.49.0"
7131+
"@sentry/cli-win32-x64" "2.49.0"
7132+
71137133
"@sentry/rollup-plugin@^3.5.0":
71147134
version "3.5.0"
71157135
resolved "https://registry.yarnpkg.com/@sentry/rollup-plugin/-/rollup-plugin-3.5.0.tgz#9015c48e00257f8440597167498499804371329b"

0 commit comments

Comments
 (0)