Skip to content

Commit 0329555

Browse files
Lms24andreiborza
andauthored
fix(v9/remix): Ensure source maps upload fails silently if Sentry CLI fails (#17095)
Backport of #17082 --------- Co-authored-by: Andrei <[email protected]>
1 parent 2f069f5 commit 0329555

File tree

4 files changed

+90
-51
lines changed

4 files changed

+90
-51
lines changed

packages/remix/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
"@opentelemetry/instrumentation": "^0.57.2",
6969
"@opentelemetry/semantic-conventions": "^1.34.0",
7070
"@remix-run/router": "1.x",
71-
"@sentry/cli": "^2.46.0",
71+
"@sentry/cli": "^2.50.0",
7272
"@sentry/core": "9.40.0",
7373
"@sentry/node": "9.40.0",
7474
"@sentry/react": "9.40.0",

packages/remix/scripts/createRelease.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,22 @@ async function createRelease(argv, URL_PREFIX, BUILD_PATH) {
2727

2828
await sentry.releases.new(release);
2929

30-
await sentry.releases.uploadSourceMaps(release, {
31-
urlPrefix: URL_PREFIX,
32-
include: [BUILD_PATH],
33-
useArtifactBundle: !argv.disableDebugIds,
34-
});
30+
try {
31+
await sentry.releases.uploadSourceMaps(release, {
32+
urlPrefix: URL_PREFIX,
33+
include: [BUILD_PATH],
34+
useArtifactBundle: !argv.disableDebugIds,
35+
live: 'rejectOnError',
36+
});
37+
} catch {
38+
console.warn('[sentry] Failed to upload sourcemaps.');
39+
}
3540

36-
await sentry.releases.finalize(release);
41+
try {
42+
await sentry.releases.finalize(release);
43+
} catch {
44+
console.warn('[sentry] Failed to finalize release.');
45+
}
3746

3847
if (argv.deleteAfterUpload) {
3948
try {

packages/remix/test/scripts/upload-sourcemaps.test.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ const uploadSourceMapsMock = vi.fn();
55
const finalizeMock = vi.fn();
66
const proposeVersionMock = vi.fn(() => '0.1.2.3.4');
77

8+
const consoleWarnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
9+
810
// The createRelease script requires the Sentry CLI, which we need to mock so we
911
// hook require to do this
1012
async function mock(mockedUri: string, stub: any) {
@@ -56,6 +58,7 @@ describe('createRelease', () => {
5658
urlPrefix: '~/build/',
5759
include: ['public/build'],
5860
useArtifactBundle: true,
61+
live: 'rejectOnError',
5962
});
6063
expect(finalizeMock).toHaveBeenCalledWith('0.1.2.3');
6164
});
@@ -69,6 +72,7 @@ describe('createRelease', () => {
6972
urlPrefix: '~/build/',
7073
include: ['public/build'],
7174
useArtifactBundle: true,
75+
live: 'rejectOnError',
7276
});
7377
expect(finalizeMock).toHaveBeenCalledWith('0.1.2.3.4');
7478
});
@@ -89,9 +93,35 @@ describe('createRelease', () => {
8993
urlPrefix: '~/build/',
9094
include: ['public/build'],
9195
useArtifactBundle: true,
96+
live: 'rejectOnError',
9297
});
9398
expect(finalizeMock).toHaveBeenCalledWith('0.1.2.3.4');
9499
});
100+
101+
it('logs an error when uploadSourceMaps fails', async () => {
102+
uploadSourceMapsMock.mockRejectedValue(new Error('Failed to upload sourcemaps'));
103+
104+
await createRelease({}, '~/build/', 'public/build');
105+
106+
expect(uploadSourceMapsMock).toHaveBeenCalledWith('0.1.2.3.4', {
107+
urlPrefix: '~/build/',
108+
include: ['public/build'],
109+
useArtifactBundle: true,
110+
live: 'rejectOnError',
111+
});
112+
113+
expect(consoleWarnSpy).toHaveBeenCalledWith('[sentry] Failed to upload sourcemaps.');
114+
115+
expect(finalizeMock).toHaveBeenCalledWith('0.1.2.3.4');
116+
});
117+
118+
it('logs an error when finalize fails', async () => {
119+
finalizeMock.mockRejectedValue(new Error('Failed to finalize release'));
120+
121+
await createRelease({}, '~/build/', 'public/build');
122+
123+
expect(consoleWarnSpy).toHaveBeenCalledWith('[sentry] Failed to finalize release.');
124+
});
95125
});
96126

97127
// To avoid `--isolatedModules` flag as we're not importing

yarn.lock

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -6981,75 +6981,75 @@
69816981
resolved "https://registry.yarnpkg.com/@sentry/cli-darwin/-/cli-darwin-2.42.2.tgz#a32a4f226e717122b37d9969e8d4d0e14779f720"
69826982
integrity sha512-GtJSuxER7Vrp1IpxdUyRZzcckzMnb4N5KTW7sbTwUiwqARRo+wxS+gczYrS8tdgtmXs5XYhzhs+t4d52ITHMIg==
69836983

6984-
"@sentry/cli-darwin@2.46.0":
6985-
version "2.46.0"
6986-
resolved "https://registry.yarnpkg.com/@sentry/cli-darwin/-/cli-darwin-2.46.0.tgz#e07ff66f03e8cb6e1988b7673ae5dbd6ff957b1d"
6987-
integrity sha512-5Ll+e5KAdIk9OYiZO8aifMBRNWmNyPjSqdjaHlBC1Qfh7pE3b1zyzoHlsUazG0bv0sNrSGea8e7kF5wIO1hvyg==
6984+
"@sentry/cli-darwin@2.50.0":
6985+
version "2.50.0"
6986+
resolved "https://registry.yarnpkg.com/@sentry/cli-darwin/-/cli-darwin-2.50.0.tgz#0fec0ece84afe37b33464ccd514367fc95d507f3"
6987+
integrity sha512-Aj+cLBZ0dCw+pdUxvJ1U71PnKh2YjvpzLN9h1ZTe8UI3FqmkKkSH/J8mN/5qmR7qUHjDcm2l+wfgVUaaP8CWbA==
69886988

69896989
69906990
version "2.42.2"
69916991
resolved "https://registry.yarnpkg.com/@sentry/cli-linux-arm64/-/cli-linux-arm64-2.42.2.tgz#1c06c83ff21f51ec23acf5be3b1f8c7553bf86b1"
69926992
integrity sha512-BOxzI7sgEU5Dhq3o4SblFXdE9zScpz6EXc5Zwr1UDZvzgXZGosUtKVc7d1LmkrHP8Q2o18HcDWtF3WvJRb5Zpw==
69936993

6994-
"@sentry/cli-linux-arm64@2.46.0":
6995-
version "2.46.0"
6996-
resolved "https://registry.yarnpkg.com/@sentry/cli-linux-arm64/-/cli-linux-arm64-2.46.0.tgz#d5b27e5813e7b3add65c9e3dbdd75a8bea4ef324"
6997-
integrity sha512-OEJN8yAjI9y5B4telyqzu27Hi3+S4T8VxZCqJz1+z2Mp0Q/MZ622AahVPpcrVq/5bxrnlZR16+lKh8L1QwNFPg==
6994+
"@sentry/cli-linux-arm64@2.50.0":
6995+
version "2.50.0"
6996+
resolved "https://registry.yarnpkg.com/@sentry/cli-linux-arm64/-/cli-linux-arm64-2.50.0.tgz#bbafacf82766d45ff05434cd7cabbda7005d1efd"
6997+
integrity sha512-p6hIh4Bb87qBfEz9w5dxEPAohIKcw68qoy5VUTx+cCanO8uXNWWsT78xtUNFRscW9zc6MxQMSITTWaCEIKvxRA==
69986998

69996999
70007000
version "2.42.2"
70017001
resolved "https://registry.yarnpkg.com/@sentry/cli-linux-arm/-/cli-linux-arm-2.42.2.tgz#00cadc359ae3c051efb3e63873c033c61dbd1ca1"
70027002
integrity sha512-7udCw+YL9lwq+9eL3WLspvnuG+k5Icg92YE7zsteTzWLwgPVzaxeZD2f8hwhsu+wmL+jNqbpCRmktPteh3i2mg==
70037003

7004-
"@sentry/cli-linux-arm@2.46.0":
7005-
version "2.46.0"
7006-
resolved "https://registry.yarnpkg.com/@sentry/cli-linux-arm/-/cli-linux-arm-2.46.0.tgz#d2a0f21cd208ef8e844bc5e565b337640d125441"
7007-
integrity sha512-WRrLNq/TEX/TNJkGqq6Ad0tGyapd5dwlxtsPbVBrIdryuL1mA7VCBoaHBr3kcwJLsgBHFH0lmkMee2ubNZZdkg==
7004+
"@sentry/cli-linux-arm@2.50.0":
7005+
version "2.50.0"
7006+
resolved "https://registry.yarnpkg.com/@sentry/cli-linux-arm/-/cli-linux-arm-2.50.0.tgz#e1fed09b94c508db9de5353d8305828b0a3551e9"
7007+
integrity sha512-SGPAFwOY2of2C+RUBJcxMN2JXikVFEk8ypYOsQTEvV/48cLejcO/O2mHIj/YKgIkrfn3t7LlqdK6g75lkz+F8Q==
70087008

70097009
70107010
version "2.42.2"
70117011
resolved "https://registry.yarnpkg.com/@sentry/cli-linux-i686/-/cli-linux-i686-2.42.2.tgz#3b817b715dd806c20dfbffd539725ad8089c310a"
70127012
integrity sha512-Sw/dQp5ZPvKnq3/y7wIJyxTUJYPGoTX/YeMbDs8BzDlu9to2LWV3K3r7hE7W1Lpbaw4tSquUHiQjP5QHCOS7aQ==
70137013

7014-
"@sentry/cli-linux-i686@2.46.0":
7015-
version "2.46.0"
7016-
resolved "https://registry.yarnpkg.com/@sentry/cli-linux-i686/-/cli-linux-i686-2.46.0.tgz#73368ebe30236c8647caec420f717a7f45410f29"
7017-
integrity sha512-xko3/BVa4LX8EmRxVOCipV+PwfcK5Xs8lP6lgF+7NeuAHMNL4DqF6iV9rrN8gkGUHCUI9RXSve37uuZnFy55+Q==
7014+
"@sentry/cli-linux-i686@2.50.0":
7015+
version "2.50.0"
7016+
resolved "https://registry.yarnpkg.com/@sentry/cli-linux-i686/-/cli-linux-i686-2.50.0.tgz#95f0eb65bdde4c33e492830ae4ac207b60494f8e"
7017+
integrity sha512-umhGmbiCUG7MvjTm8lXFmFxQjyTVtYakilBwPTVzRELmNKxxhfKRxwSSA+hUKetAUzNd8fJx8K7yqdw+qRA7Pg==
70187018

70197019
70207020
version "2.42.2"
70217021
resolved "https://registry.yarnpkg.com/@sentry/cli-linux-x64/-/cli-linux-x64-2.42.2.tgz#ddf906bc3071cc79ce6e633eddcb76bb9068e688"
70227022
integrity sha512-mU4zUspAal6TIwlNLBV5oq6yYqiENnCWSxtSQVzWs0Jyq97wtqGNG9U+QrnwjJZ+ta/hvye9fvL2X25D/RxHQw==
70237023

7024-
"@sentry/cli-linux-x64@2.46.0":
7025-
version "2.46.0"
7026-
resolved "https://registry.yarnpkg.com/@sentry/cli-linux-x64/-/cli-linux-x64-2.46.0.tgz#49da3dfd873e0e72abef968e1c213b9397e5d70e"
7027-
integrity sha512-hJ1g5UEboYcOuRia96LxjJ0jhnmk8EWLDvlGnXLnYHkwy3ree/L7sNgdp/QsY8Z4j2PGO5f22Va+UDhSjhzlfQ==
7024+
"@sentry/cli-linux-x64@2.50.0":
7025+
version "2.50.0"
7026+
resolved "https://registry.yarnpkg.com/@sentry/cli-linux-x64/-/cli-linux-x64-2.50.0.tgz#5266b6b8660e6b72688331b7c702e9d1ca6413ed"
7027+
integrity sha512-ugIIx9+wUmguxOUe9ZVacvdCffZwqtFSKwpJ06Nqes0XfL4ZER4Qlq3/miCZ8m150C4xK5ym/QCwB41ffBqI4g==
70287028

7029-
"@sentry/cli-win32-arm64@2.46.0":
7030-
version "2.46.0"
7031-
resolved "https://registry.yarnpkg.com/@sentry/cli-win32-arm64/-/cli-win32-arm64-2.46.0.tgz#4e26b254d5283eb114ac916ac504283a30b2ecdb"
7032-
integrity sha512-mN7cpPoCv2VExFRGHt+IoK11yx4pM4ADZQGEso5BAUZ5duViXB2WrAXCLd8DrwMnP0OE978a7N8OtzsFqjkbNA==
7029+
"@sentry/cli-win32-arm64@2.50.0":
7030+
version "2.50.0"
7031+
resolved "https://registry.yarnpkg.com/@sentry/cli-win32-arm64/-/cli-win32-arm64-2.50.0.tgz#663d75fea42b853940c6faacf7ee76a16b449654"
7032+
integrity sha512-fMyBSKLrVHY9944t8oTpul+6osyQeuN8GGGP3diDxGQpynYL+vhcHZIpXFRH398+3kedG/IFoY7EwGgIEqWzmw==
70337033

70347034
70357035
version "2.42.2"
70367036
resolved "https://registry.yarnpkg.com/@sentry/cli-win32-i686/-/cli-win32-i686-2.42.2.tgz#9036085c7c6ce455ad45fda411c55ff39c06eb95"
70377037
integrity sha512-iHvFHPGqgJMNqXJoQpqttfsv2GI3cGodeTq4aoVLU/BT3+hXzbV0x1VpvvEhncJkDgDicJpFLM8sEPHb3b8abw==
70387038

7039-
"@sentry/cli-win32-i686@2.46.0":
7040-
version "2.46.0"
7041-
resolved "https://registry.yarnpkg.com/@sentry/cli-win32-i686/-/cli-win32-i686-2.46.0.tgz#72f7c0a611f17b7e5b34e2b47309d165195a8276"
7042-
integrity sha512-6F73AUE3lm71BISUO19OmlnkFD5WVe4/wA1YivtLZTc1RU3eUYJLYxhDfaH3P77+ycDppQ2yCgemLRaA4A8mNQ==
7039+
"@sentry/cli-win32-i686@2.50.0":
7040+
version "2.50.0"
7041+
resolved "https://registry.yarnpkg.com/@sentry/cli-win32-i686/-/cli-win32-i686-2.50.0.tgz#96813ca970f35a839d7f817534ac556bc1df1567"
7042+
integrity sha512-VbC+l2Y2kB7Lsun2c8t7ZGwmljmXnyncZLW9PjdEyJSTAJ9GnEnSvyFSPXNLV/eHJnfQffzU7QTjU8vkQ7XMYg==
70437043

70447044
70457045
version "2.42.2"
70467046
resolved "https://registry.yarnpkg.com/@sentry/cli-win32-x64/-/cli-win32-x64-2.42.2.tgz#7d6464b63f32c9f97fff428f246b1f039b402233"
70477047
integrity sha512-vPPGHjYoaGmfrU7xhfFxG7qlTBacroz5NdT+0FmDn6692D8IvpNXl1K+eV3Kag44ipJBBeR8g1HRJyx/F/9ACw==
70487048

7049-
"@sentry/cli-win32-x64@2.46.0":
7050-
version "2.46.0"
7051-
resolved "https://registry.yarnpkg.com/@sentry/cli-win32-x64/-/cli-win32-x64-2.46.0.tgz#8cfd438ec365b0ee925d9724a24b533b4cb75587"
7052-
integrity sha512-yuGVcfepnNL84LGA0GjHzdMIcOzMe0bjPhq/rwPsPN+zu11N+nPR2wV2Bum4U0eQdqYH3iAlMdL5/BEQfuLJww==
7049+
"@sentry/cli-win32-x64@2.50.0":
7050+
version "2.50.0"
7051+
resolved "https://registry.yarnpkg.com/@sentry/cli-win32-x64/-/cli-win32-x64-2.50.0.tgz#9f644efed8cb75943078a0ca4e414fa21dda6280"
7052+
integrity sha512-nMktyF93NtQUOViAAKHpHSWACOGjOkKjiewi4pD6W3sWllFiPPyt15XoyApqWwnICDRQu2DI5vnil4ck6/k7mw==
70537053

70547054
70557055
version "2.42.2"
@@ -7070,25 +7070,25 @@
70707070
"@sentry/cli-win32-i686" "2.42.2"
70717071
"@sentry/cli-win32-x64" "2.42.2"
70727072

7073-
"@sentry/cli@^2.36.1", "@sentry/cli@^2.46.0":
7074-
version "2.46.0"
7075-
resolved "https://registry.yarnpkg.com/@sentry/cli/-/cli-2.46.0.tgz#790864874ea04f804053aa85dc94501b2cc321bb"
7076-
integrity sha512-nqoPl7UCr446QFkylrsRrUXF51x8Z9dGquyf4jaQU+OzbOJMqclnYEvU6iwbwvaw3tu/2DnoZE/Og+Nq1h63sA==
7073+
"@sentry/cli@^2.36.1", "@sentry/cli@^2.46.0", "@sentry/cli@^2.50.0":
7074+
version "2.50.0"
7075+
resolved "https://registry.yarnpkg.com/@sentry/cli/-/cli-2.50.0.tgz#7e2298bea9a2bb50126bfb24116ae98199bc1f6f"
7076+
integrity sha512-OHRRQPUNjBpzOT6arNhxXQ71DKs5jSziCfDzmEGwAs+K8J/I1QxnvJkto88HbXE54oiWhSEJwL0pvcowFXyVbA==
70777077
dependencies:
70787078
https-proxy-agent "^5.0.0"
70797079
node-fetch "^2.6.7"
70807080
progress "^2.0.3"
70817081
proxy-from-env "^1.1.0"
70827082
which "^2.0.2"
70837083
optionalDependencies:
7084-
"@sentry/cli-darwin" "2.46.0"
7085-
"@sentry/cli-linux-arm" "2.46.0"
7086-
"@sentry/cli-linux-arm64" "2.46.0"
7087-
"@sentry/cli-linux-i686" "2.46.0"
7088-
"@sentry/cli-linux-x64" "2.46.0"
7089-
"@sentry/cli-win32-arm64" "2.46.0"
7090-
"@sentry/cli-win32-i686" "2.46.0"
7091-
"@sentry/cli-win32-x64" "2.46.0"
7084+
"@sentry/cli-darwin" "2.50.0"
7085+
"@sentry/cli-linux-arm" "2.50.0"
7086+
"@sentry/cli-linux-arm64" "2.50.0"
7087+
"@sentry/cli-linux-i686" "2.50.0"
7088+
"@sentry/cli-linux-x64" "2.50.0"
7089+
"@sentry/cli-win32-arm64" "2.50.0"
7090+
"@sentry/cli-win32-i686" "2.50.0"
7091+
"@sentry/cli-win32-x64" "2.50.0"
70927092

70937093
"@sentry/rollup-plugin@^3.5.0":
70947094
version "3.5.0"

0 commit comments

Comments
 (0)