sentry-javascript
sentry-javascript copied to clipboard
Updated `ensureCLIBinaryExists` does not work properly with Yarn Berry (PnP)
Is there an existing issue for this?
- [X] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- [X] I have reviewed the documentation https://docs.sentry.io/
- [X] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which package are you using?
@sentry/nextjs
SDK Version
7.11.1
Framework Version
12.2.5
Link to Sentry event
N/A
Steps to Reproduce
https://yarnpkg.com/features/pnp
Latest ensureCLIBinaryExists() impl:
function ensureCLIBinaryExists(): boolean {
for (const node_modulesPath of module.paths) {
if (fs.existsSync(path.resolve(node_modulesPath, '@sentry/cli/sentry-cli'))) {
return true;
}
}
return false;
}
This has an issue with Yarn PnP:
- Yarn PnP does not install things under
node_modules/. - However it has helper functions in
.pnp.cjswhich wrapsrequire.resolve,fs.*functions to work with their Zip archived dependency installations. - Thus
path.resolve()is not able to find@sentry/cli/sentry-cliwhen they are installed with Yarn PnP.
I have found that ensureCLIBinaryExists() has following history of:
- Initially written with
require.resolve: (https://github.com/getsentry/sentry-javascript/pull/4311) - then wrapped with
eval: (https://github.com/getsentry/sentry-javascript/pull/4988) - and then to the latest impl that uses
path.resolve: (https://github.com/getsentry/sentry-javascript/pull/5447)
However the latest one does not work well with Yarn PnP. Currently we have downgraded sentry SDK to 7.7.0 mitigate this issue.
Expected Result
ensureCLIBinaryExists() returns true
Actual Result
ensureCLIBinaryExists() returns false even with @sentry/cli installed.
This issue has gone three weeks without activity. In another week, I will close it.
But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!
"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀
I am also having the same issue. I'm using that commit as a temporary workaround until the issue is resolved. https://github.com/getsentry/sentry-javascript/commit/8a06b16d605ca3a1fa6c9af2a701f332e39799ed
Hi, we updated the logic for this. Can you check if that fixed this issue?
This issue has gone three weeks without activity. In another week, I will close it.
But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!
"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀