getsentry / profiling-node

The code for this repo now lives in https://github.com/getsentry/sentry-javascript/tree/develop/packages/profiling-node
MIT License
29 stars 10 forks source link

Profiling modules not being found #106

Closed joshanangelofgrace closed 1 year ago

joshanangelofgrace commented 1 year ago

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

SDK Version

0.2.2

Link to Sentry event

No response

What environment is your node script running in?

Windows 11, Node v 18.14.0, using Express

How is your code deployed and bundled?

Dependencies are required on remote and are used in runtime.

Steps to Reproduce

Added latest version of Sentry Profiling as per instructions in the documentation Configured Sentry as follows: `import { Express } from 'express' import as Sentry from '@sentry/node' import as Tracing from '@sentry/tracing' import { ProfilingIntegration } from '@sentry/profiling-node'

export function initSentry(app: Express) { Sentry.init({ dsn: '<>', integrations: [ // enable HTTP calls tracing new Sentry.Integrations.Http({ tracing: true }), // enable Express.js middleware tracing new Tracing.Integrations.Express({ app }), new ProfilingIntegration() ],

    // Set tracesSampleRate to 1.0 to capture 100%
    // of transactions for performance monitoring.
    // We recommend adjusting this value in production
    tracesSampleRate: 1.0,
    profilesSampleRate: 1.0,
    environment: process.env.NODE_ENV
})

app.use(Sentry.Handlers.requestHandler())
app.use(Sentry.Handlers.tracingHandler())
app.use(Sentry.Handlers.errorHandler())

}`

Expected Result

That the app compiles and runs without error and that profiling works

Actual Result

Compile error occurs during compilation saying that the module for my computer cannot be found

image
JonasBa commented 1 year ago

@joshanangelofgrace can you check if binaries folder does include that file? If it does not, the module should have built the cpu bindings from source, are you seeing any errors when you run npm i @sentry/profiling-node?

JonasBa commented 1 year ago

@joshanangelofgrace any updates on this?

would you mind running npm install --verbose --foreground-scripts @sentry/profiling-node in an empty directory and sending us the logs?

AlexRMU commented 1 year ago

+ In docker node:20-alpine

"@sentry/profiling-node": "^1.0.2",
Node.js v20.3.0                                                                                                                                           
node:internal/modules/cjs/loader:1070                                                                                                                     
  const err = new Error(message);                                                                                                                         
              ^                                                                                                                                           

Error: Cannot find module './sentry_cpu_profiler-linux-x64-musl-115.node'                                                                                 
Require stack:                                                                                                                                            
- /app/node_modules/@sentry/profiling-node/lib/index.mjs                                                                                                  
    at Module._resolveFilename (node:internal/modules/cjs/loader:1070:15)                                                                                 
    at Module._load (node:internal/modules/cjs/loader:923:27)                                                                                             
    at Module.require (node:internal/modules/cjs/loader:1137:19)                                                                                          
    at require (node:internal/modules/helpers:121:18)                                                                                                     
    at importCppBindingsModule (file:///app/node_modules/@sentry/profiling-node/lib/index.mjs:16688:14)                                                   
    at file:///app/node_modules/@sentry/profiling-node/lib/index.mjs:16692:34                                                                             
    at ModuleJob.run (node:internal/modules/esm/module_job:192:25)                                                                                        
    at async DefaultModuleLoader.import (node:internal/modules/esm/loader:246:24)                                                                         
    at async loadESM (node:internal/process/esm_loader:40:7)                                                                                              
    at async handleMainPromise (node:internal/modules/run_main:66:12) {                                                                                   
  code: 'MODULE_NOT_FOUND',                                                                                                                               
  requireStack: [ '/app/node_modules/@sentry/profiling-node/lib/index.mjs' ]                                                                              
}
JonasBa commented 1 year ago

I'm going to close this as a duplicate of https://github.com/getsentry/profiling-node/issues/141#issuecomment-1589551839, please upgrade to 1.0.4 and let me know if this still fails.