Skip to content

Commit 06c1a6f

Browse files
authored
fix(nextjs): CLI binary not found on Windows (#6096)
1 parent 0ccb760 commit 06c1a6f

File tree

3 files changed

+30
-27
lines changed

3 files changed

+30
-27
lines changed

packages/nextjs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"@sentry/tracing": "7.17.3",
2727
"@sentry/types": "7.17.3",
2828
"@sentry/utils": "7.17.3",
29-
"@sentry/webpack-plugin": "1.19.0",
29+
"@sentry/webpack-plugin": "1.20.0",
3030
"chalk": "3.0.0",
3131
"rollup": "2.78.0",
3232
"tslib": "^1.9.3"

packages/nextjs/src/config/webpack.ts

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -446,36 +446,18 @@ export function getWebpackPluginOptions(
446446
return { ...defaultPluginOptions, ...userPluginOptions };
447447
}
448448

449-
/**
450-
* NOTE: We're faking `require.resolve` here as a workaround for @vercel/nft detecting the binary itself as a hard
451-
* dependency and always including it in the bundle, which is not what we want.
452-
*
453-
* ref: https://github.com/getsentry/sentry-javascript/issues/3865
454-
* ref: https://github.com/vercel/nft/issues/203
455-
*/
456-
function ensureCLIBinaryExists(): boolean {
457-
for (const node_modulesPath of module.paths) {
458-
if (fs.existsSync(path.resolve(node_modulesPath, '@sentry/cli/sentry-cli'))) {
459-
return true;
460-
}
461-
}
462-
return false;
463-
}
464-
465449
/** Check various conditions to decide if we should run the plugin */
466450
function shouldEnableWebpackPlugin(buildContext: BuildContext, userSentryOptions: UserSentryOptions): boolean {
467451
const { isServer, dev: isDev } = buildContext;
468452
const { disableServerWebpackPlugin, disableClientWebpackPlugin } = userSentryOptions;
469453

470454
/** Non-negotiable */
471455

472-
// TODO: this is a hack to fix https://github.com/getsentry/sentry-cli/issues/1085, which is caused by
473-
// https://github.com/getsentry/sentry-cli/issues/915. Once the latter is addressed, this existence check can come
474-
// out. (The check is necessary because currently, `@sentry/cli` uses a post-install script to download an
456+
// This check is necessary because currently, `@sentry/cli` uses a post-install script to download an
475457
// architecture-specific version of the `sentry-cli` binary. If `yarn install`, `npm install`, or `npm ci` are run
476458
// with the `--ignore-scripts` option, this will be blocked and the missing binary will cause an error when users
477-
// try to build their apps.)
478-
if (!ensureCLIBinaryExists()) {
459+
// try to build their apps.
460+
if (!SentryWebpackPlugin.cliBinaryExists()) {
479461
return false;
480462
}
481463

yarn.lock

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4332,13 +4332,34 @@
43324332
proxy-from-env "^1.1.0"
43334333
which "^2.0.2"
43344334

4335+
"@sentry/cli@^1.74.6":
4336+
version "1.74.6"
4337+
resolved "https://registry.yarnpkg.com/@sentry/cli/-/cli-1.74.6.tgz#c4f276e52c6f5e8c8d692845a965988068ebc6f5"
4338+
integrity sha512-pJ7JJgozyjKZSTjOGi86chIngZMLUlYt2HOog+OJn+WGvqEkVymu8m462j1DiXAnex9NspB4zLLNuZ/R6rTQHg==
4339+
dependencies:
4340+
https-proxy-agent "^5.0.0"
4341+
mkdirp "^0.5.5"
4342+
node-fetch "^2.6.7"
4343+
npmlog "^4.1.2"
4344+
progress "^2.0.3"
4345+
proxy-from-env "^1.1.0"
4346+
which "^2.0.2"
4347+
43354348
43364349
version "1.19.0"
43374350
resolved "https://registry.yarnpkg.com/@sentry/webpack-plugin/-/webpack-plugin-1.19.0.tgz#2b134318f1552ba7f3e3f9c83c71a202095f7a44"
43384351
integrity sha512-qSpdgdGMtdzagGveSWgo2b+t8PdPUscuOjbOyWCsJme9jlTFnNk0rX7JEA55OUozikKHM/+vVh08USLBnPboZw==
43394352
dependencies:
43404353
"@sentry/cli" "^1.74.4"
43414354

4355+
4356+
version "1.20.0"
4357+
resolved "https://registry.yarnpkg.com/@sentry/webpack-plugin/-/webpack-plugin-1.20.0.tgz#e7add76122708fb6b4ee7951294b521019720e58"
4358+
integrity sha512-Ssj1mJVFsfU6vMCOM2d+h+KQR7QHSfeIP16t4l20Uq/neqWXZUQ2yvQfe4S3BjdbJXz/X4Rw8Hfy1Sd0ocunYw==
4359+
dependencies:
4360+
"@sentry/cli" "^1.74.6"
4361+
webpack-sources "^2.0.0 || ^3.0.0"
4362+
43424363
"@simple-dom/interface@^1.4.0":
43434364
version "1.4.0"
43444365
resolved "https://registry.yarnpkg.com/@simple-dom/interface/-/interface-1.4.0.tgz#e8feea579232017f89b0138e2726facda6fbb71f"
@@ -25532,16 +25553,16 @@ [email protected], webpack-sources@^1.1.0, webpack-sources@^1.2.0, webpack-s
2553225553
source-list-map "^2.0.0"
2553325554
source-map "~0.6.1"
2553425555

25556+
"webpack-sources@^2.0.0 || ^3.0.0", webpack-sources@^3.2.3:
25557+
version "3.2.3"
25558+
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.2.3.tgz#2d4daab8451fd4b240cc27055ff6a0c2ccea0cde"
25559+
integrity sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==
25560+
2553525561
webpack-sources@^3.2.2:
2553625562
version "3.2.2"
2553725563
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.2.2.tgz#d88e3741833efec57c4c789b6010db9977545260"
2553825564
integrity sha512-cp5qdmHnu5T8wRg2G3vZZHoJPN14aqQ89SyQ11NpGH5zEMDCclt49rzo+MaRazk7/UeILhAI+/sEtcM+7Fr0nw==
2553925565

25540-
webpack-sources@^3.2.3:
25541-
version "3.2.3"
25542-
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.2.3.tgz#2d4daab8451fd4b240cc27055ff6a0c2ccea0cde"
25543-
integrity sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==
25544-
2554525566
2554625567
version "1.4.1"
2554725568
resolved "https://registry.yarnpkg.com/webpack-subresource-integrity/-/webpack-subresource-integrity-1.4.1.tgz#e8bf918b444277df46a66cd84542cbcdc5a6272d"

0 commit comments

Comments
 (0)