Skip to content

Error: Cannot find module '/home/node/app/build/node_modules/@sentry/profiling-node on Sentry initialization. #11241

Description

@hassenc

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

7.107.0

Framework Version

No response

Link to Sentry event

No response

SDK Setup

Sentry.init({
     dsn: process.env.sentry_DSN,
     integrations: [
       // enable HTTP calls tracing
       new Sentry.Integrations.Http({ tracing: true }),
       // enable Express.js middleware tracing
       new Sentry.Integrations.Express({ app }),
       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 - When I run Sentry locally (node 21) , it runs as expected
2 - When I run Sentry on production, I get this error when the service starts

Docker image : node:21.2.0-alpine
Error: Cannot find module '/home/node/app/build/node_modules/@sentry/profiling-node/lib/sentry_cpu_profiler-linux-x64-musl-120.node'

Docker image : node:21.2.0-bullseye-slim
Error: Cannot find module '/home/node/app/build/node_modules/@sentry/profiling-node/lib/sentry_cpu_profiler-linux-x64-glibc-120.node'

When I look in node_modules/@sentry/profiling-node/lib/ the files are not there.
I'm installing dependencies with yarn install , and I'm not ignoring scripts

3 - I reached out to Support, they said that node 21 is supported and that I should create an issue here

Expected Result

I think it's normal that the bianaries do not exist for node 21, but I would expect them to be compiled ?

Actual Result

Error: Cannot find module '/home/node/app/build/node_modules/@sentry/profiling-node/lib/sentry_cpu_profiler-linux-x64-glibc-120.node'

Activity

  1. moved this to Waiting for: Product Owner in GitHub Issues with 👀 2on Mar 22, 2024
  2. Lms24 commented on Mar 22, 2024

    @Lms24
    Member

    Hey @hassenc thanks for writing in! My educated guess is that the platform binaries are not (yet) supported.
    I'm gonna tag @JonasBa - would you mind taking a look? Thanks!

  3. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 2on Mar 22, 2024
  4. Lms24 commented on Mar 22, 2024

    @Lms24
    Member

    Just found a reply from Jonas in a similar issue (#10787 (comment)) saying that we attempt to compile the binary for your platform if we don't ship a precompiled binary. Can you check if you ignore scripts somewhere that would prevent compilation?

  5. hassenc commented on Mar 22, 2024

    @hassenc
    Author

    As I said in the first message, I'm running yarn install to install dependencies. I'm not ignoring scripts

  6. moved this to Waiting for: Product Owner in GitHub Issues with 👀 2on Mar 22, 2024
  7. AbhiPrasad commented on Mar 22, 2024

    @AbhiPrasad
    Contributor

    We don't support Node 21 yet for the prebuilt binaries, we only generate binaries for Node 16-20.

    I opened a PR to our docs to make this more clear getsentry/sentry-docs#9540

    I don't think we'll be adding support for pre-building binaries to non-LTS versions of Node because of the potential instability of the ABI.

  8. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 2on Mar 22, 2024
  9. 2 remaining items

  10. moved this to Waiting for: Product Owner in GitHub Issues with 👀 2on Mar 22, 2024
  11. JonasBa commented on Mar 22, 2024

    @JonasBa
    Contributor

    @hassenc If there are no errors, then the binary should be there. Are you running these commands from inside Docker? If there are no errors, then the binary should have been generated, can you verify that?

    I wouldnt recommend updating the Docker image just yet, as we dont know yet what the actual issue is. From what I understand, you are saying that building the binaries from inside docker does not error, but the file is also not present, which is very odd.

  12. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 2on Mar 22, 2024
  13. hassenc commented on Mar 25, 2024

    @hassenc
    Author

    I was testing on a different environment.
    I built the Docker image locally and I do get this error

    image

    If I add this line,RUN apk add g++ make py3-pip The file is created, but the build takes longer (x3)
    Do you have an idea about when this pre-built binary will be available ?

    Thank you

  14. moved this to Waiting for: Product Owner in GitHub Issues with 👀 2on Mar 25, 2024
  15. JonasBa commented on Mar 25, 2024

    @JonasBa
    Contributor

    @hassenc yes, so indeed, the build fails and something swallows the error - I'm not exactly sure what, but if you do find out what makes this error invisible I'd love to know as we want it to throw at install time. I may investigate this myself, it's just not a big priority right now.

    Like @AbhiPrasad said, we dont officially support non LTS Node versions, so the answer is very likely never for v21. That said, you can expect us to ship prebuilt binaries for version 22 (iirc there is currently no release date) when it enters LTS stage. My advice would be to downgrade to v20 where the binaries are available or install the correct tooling and compile from source, which slows down your docker build process like you noticed. You can likely speed up that part by leveraging a local or remote build cache for your image, which should make things substantially faster as you wont be reinstalling these expensive dependencies each time you build your docker image

  16. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 2on Mar 25, 2024
  17. bzhn commented on Dec 29, 2024

    @bzhn

    Switching from node v23.4.0 to v22.12.0 helped me solve this issue.

  18. JefferyHus commented on Sep 4, 2025

    @JefferyHus

    How to check which node version is supported and which is not for prebuilt binaries?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions