Skip to content

Updated ensureCLIBinaryExists does not work properly with Yarn Berry (PnP) #5632

@vhain

Description

@vhain

Is there an existing issue for this?

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.cjs which wraps require.resolve, fs.* functions to work with their Zip archived dependency installations.
  • Thus path.resolve() is not able to find @sentry/cli/sentry-cli when they are installed with Yarn PnP.

I have found that ensureCLIBinaryExists() has following history of:

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Package: nextjsIssues related to the Sentry Nextjs SDK

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions