Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run profiling-node on 32-bit operating system #12899

Open
3 tasks done
naheller opened this issue Jul 12, 2024 · 1 comment
Open
3 tasks done

Unable to run profiling-node on 32-bit operating system #12899

naheller opened this issue Jul 12, 2024 · 1 comment
Labels

Comments

@naheller
Copy link

naheller commented Jul 12, 2024

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/node

SDK Version

8.17.0

Framework Version

@sentry/node 8.17.0

Link to Sentry event

No response

SDK Setup/Reproduction Example

// Import with `import * as Sentry from "@sentry/node"` if you are using ESM
const Sentry = require("@sentry/node");
const { nodeProfilingIntegration } = require("@sentry/profiling-node");

Sentry.init({
  dsn: "https://<my-key>.ingest.us.sentry.io/4507555508453376",
  integrations: [nodeProfilingIntegration()],
  // Performance Monitoring
  tracesSampleRate: 1.0, //  Capture 100% of the transactions

  // Set sampling rate for profiling - this is relative to tracesSampleRate
  profilesSampleRate: 1.0,
});

Steps to Reproduce

  1. Install and setup Sentry for Fastify according to the guide
  2. Run project successfully on arm64 Mac
  3. Move project to 32-bit debian (raspberry pi OS)
  4. Run project
  5. Notice that the application crashes (See error in "Actual Result" section)

Expected Result

If precompiled binary is not found for the dynamically constructed source path, there should be fallback functionality that builds the required binary from source. In this case, for 32-bit linux.

Otherwise, if there is no automatic fallback behavior, there should be steps outlining a manual approach in the setup guide.

Actual Result

Notice the following error when running line require("@sentry/profiling-node") in Fastify app:

Error: Cannot find module '/home/node/app/node_modules/@sentry/profiling-node/lib/sentry_cpu_profiler-linux-arm-glibc-115.node'
Require stack:
- /home/node/app/node_modules/@sentry/profiling-node/lib/cjs/index.js
- /home/node/app/instrument.js
- /home/node/app/app.js
- /home/node/app/node_modules/fastify-cli/util.js
- /home/node/app/node_modules/fastify-cli/args.js
- /home/node/app/node_modules/fastify-cli/start.js
- /home/node/app/node_modules/fastify-cli/cli.js
     at Module._resolveFilename (node:internal/modules/cjs/loader:1145:15)
     at Module._load (node:internal/modules/cjs/loader:986:27)
     at Module.require (node:internal/modules/cjs/loader:1233:19)
     at require (node:internal/modules/helpers:179:18)
     at importCppBindingsModule (/home/node/app/node_modules/@sentry/profiling-node/lib/cjs/index.js:166:10)
     at Object.<anonymous> (/home/node/app/node_modules/@sentry/profiling-node/lib/cjs/index.js:169:36)
     at Module._compile (node:internal/modules/cjs/loader:1358:14)
     at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
     at Module.load (node:internal/modules/cjs/loader:1208:32)
     at Module._load (node:internal/modules/cjs/loader:1024:12) {
   code: 'MODULE_NOT_FOUND',
   requireStack: [
     '/home/node/app/node_modules/@sentry/profiling-node/lib/cjs/index.js',
     '/home/node/app/instrument.js',
     '/home/node/app/app.js',
     '/home/node/app/node_modules/fastify-cli/util.js',
     '/home/node/app/node_modules/fastify-cli/args.js',
     '/home/node/app/node_modules/fastify-cli/start.js',
     '/home/node/app/node_modules/fastify-cli/cli.js'
   ]
  | }
exited with code 1

Notice that @sentry/profiling-node is trying to use a precompiled binary that does not exist. The dynamic path builder is evaluating node_os.arch() to arm, since I'm on 32-bit Linux. I see that only 64-bit precompiled binaries are provided.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Jul 12, 2024
@github-actions github-actions bot added the Package: node Issues related to the Sentry Node SDK label Jul 12, 2024
@AbhiPrasad
Copy link
Member

We do have some docs about building the binary, but they are not detailed. @JonasBa we should probably add more docs about this. Going to backlog for now, but PRs are welcome.

Aside: One issue with using arch from node:os is that it records the architecture of where node was compiled - not where node is actually running. See https://www.npmjs.com/package/system-architecture (I have a long standing TODO to just PR a new API into node.js to fix this, let me see if I can just do it this weekend).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

No branches or pull requests

2 participants