-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/node
SDK Version
10.32.1
Framework Version
nitropack 2.12.9
node v24.12.0
Link to Sentry event
No response
Reproduction Example/SDK Setup
We're running Sentry in development pointed to Spotlight.
Our setup;
Sentry.init({
dsn: environment.SENTRY_DSN,
environment: environment.ENV,
// Release version is set via SENTRY_RELEASE env var (typically git SHA in production)
// This enables source map matching
release: process.env.SENTRY_RELEASE,
enabled: isProduction || isDevelopment,
spotlight: isDevelopment,
// Enable structured logging (for Sentry.logger)
enableLogs: true,
// Performance monitoring
tracesSampleRate: 1.0,
// Node profiling configuration
profileSessionSampleRate: 1.0,
profileLifecycle: "trace",
// Integrations for auto-instrumentation
integrations: [
// HTTP instrumentation (incoming & outgoing requests)
Sentry.httpIntegration(),
// PostgreSQL instrumentation (database queries)
Sentry.postgresIntegration(),
// Node fetch instrumentation
Sentry.nativeNodeFetchIntegration(),
// Node profiling integration
nodeProfilingIntegration(),
],
// Don't send PII by default
sendDefaultPii: false,
// Tag events with runtime context
initialScope: {
tags: {
runtime,
...(commandName && { command: commandName }),
},
},
beforeSend(event, _hint) {
// In production, sanitize sensitive data from request headers
if (isProduction && event.request?.headers) {
delete event.request.headers["authorization"];
delete event.request.headers["cookie"];
}
return event;
},
});When nitro reloads the dev server from file changes, the node profiler segment faults.
✔ Nitro Server built in 864ms nitro 10:42:57 AM
ℹ Pnpm alias symlinks node modules path: /Users/max/graphed/ts-server/.nitro/dev/node_modules nitro 10:42:57 AM
[1] 69867 segmentation fault pnpm dev
I'm able to capture a backtrace with lldb which points to the node profiler.
➜ ~ pgrep -f nitro
72828
➜ ~ lldb -p 72828
(lldb) process attach --pid 72828
Process 72828 stopped
* thread #1, name = 'MainThread', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
frame #0: 0x000000018b0d0f30 libsystem_kernel.dylib`kevent + 8
libsystem_kernel.dylib`kevent:
-> 0x18b0d0f30 <+8>: b.lo 0x18b0d0f50 ; <+40>
0x18b0d0f34 <+12>: pacibsp
0x18b0d0f38 <+16>: stp x29, x30, [sp, #-0x10]!
0x18b0d0f3c <+20>: mov x29, sp
Target 0: (node) stopped.
Executable binary set to "/Users/max/.nvm/versions/node/v24.11.1/bin/node".
Architecture set to: arm64-apple-macosx-.
(lldb) c
Process 72828 resuming
Process 72828 stopped
* thread #15, name = 'WorkerThread', stop reason = EXC_BAD_ACCESS (code=1, address=0x8f64c9883d35168a)
frame #0: 0x0000000136724270 sentry_cpu_profiler-darwin-arm64-137.node`FreeAddonData(napi_env__*, void*, void*) + 44
sentry_cpu_profiler-darwin-arm64-137.node`FreeAddonData:
-> 0x136724270 <+44>: ldr x1, [x20, #0x28]
0x136724274 <+48>: mov x0, x19
0x136724278 <+52>: bl 0x1367242f4 ; CleanupSentryProfile(Profiler*, SentryProfile*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&)
0x13672427c <+56>: ldr x20, [x20]
Target 0: (node) stopped.
(lldb) bt
* thread #15, name = 'WorkerThread', stop reason = EXC_BAD_ACCESS (code=1, address=0x8f64c9883d35168a)
* frame #0: 0x0000000136724270 sentry_cpu_profiler-darwin-arm64-137.node`FreeAddonData(napi_env__*, void*, void*) + 44
frame #1: 0x0000000102ac1b50 node`void napi_env__::CallIntoModule<void node_napi_env__::CallFinalizer<true>(void (*)(napi_env__*, void*, void*), void*, void*)::'lambda'(napi_env__*)&, void node_napi_env__::CallbackIntoModule<true, void node_napi_env__::CallFinalizer<true>(void (*)(napi_env__*, void*, void*), void*, void*)::'lambda'(napi_env__*)>(void node_napi_env__::CallFinalizer<true>(void (*)(napi_env__*, void*, void*), void*, void*)::'lambda'(napi_env__*)&&)::'lambda'(napi_env__*, v8::Local<v8::Value>)>(void node_napi_env__::CallFinalizer<true>(void (*)(napi_env__*, void*, void*), void*, void*)::'lambda'(napi_env__*)&, void node_napi_env__::CallFinalizer<true>(void (*)(napi_env__*, void*, void*), void*, void*)::'lambda'(napi_env__*)&&) + 64
frame #2: 0x0000000102abcbac node`node_napi_env__::CallFinalizer(void (*)(napi_env__*, void*, void*), void*, void*) + 88
frame #3: 0x0000000102a9e47c node`v8impl::TrackedFinalizer::Finalize() + 100
frame #4: 0x0000000102abc994 node`node_napi_env__::DeleteMe() + 144
frame #5: 0x0000000102a2ba30 node`node::CleanupQueue::Drain() + 244
frame #6: 0x0000000102a8c410 node`node::Environment::RunCleanup() + 452
frame #7: 0x0000000102a054f8 node`node::FreeEnvironment(node::Environment*) + 128
frame #8: 0x0000000102c0d50c node`node::worker::Worker::Run() + 2428
frame #9: 0x0000000102c11e40 node`node::worker::Worker::StartThread(v8::FunctionCallbackInfo<v8::Value> const&)::$_0::__invoke(void*) + 80
frame #10: 0x000000018b10dc08 libsystem_pthread.dylib`_pthread_start + 136
(lldb)
Steps to Reproduce
- Setup the example nitro app
pnpm dlx giget@latest nitro nitro-app --install - Add the following config to
nitro-app/server/plugins/sentry.ts
import { defineNitroPlugin } from "nitropack/runtime";
import * as Sentry from "@sentry/node";
import { nodeProfilingIntegration } from "@sentry/profiling-node";
Sentry.init({
environment: "dev",
// Release version is set via SENTRY_RELEASE env var (typically git SHA in production)
// This enables source map matching
release: process.env.SENTRY_RELEASE,
enabled: true,
spotlight: true,
// Enable structured logging (for Sentry.logger)
enableLogs: true,
// Performance monitoring
tracesSampleRate: 1.0,
// Node profiling configuration
profileSessionSampleRate: 1.0,
profileLifecycle: "trace",
// Integrations for auto-instrumentation
integrations: [nodeProfilingIntegration()],
sendDefaultPii: false,
});
export default defineNitroPlugin((nitro) => {
console.log("Sentry plugin initialized");
// Hook into Nitro's error handler to capture exceptions
nitro.hooks.hook("error", (error) => {
Sentry.captureException(error);
});
// Ensure Sentry flushes on shutdown
nitro.hooks.hook("close", async () => {
await Sentry.close(2000);
});
});
- Run the dev server
pnpm dev - Edit a file (
server/routes/index.ts) - Seg fault:
➜ nitro-app git:(main) ✗ p dev
> nitro-app@ dev /Users/max/graphed/nitro-app
> nitro dev
➜ Local: http://localhost:3000/
➜ Network: use --host to expose
✔ Nitro Server built in 150ms nitro 11:14:59 AM
Sentry plugin initialized
✔ Nitro Server built in 71ms nitro 11:15:04 AM
Sentry plugin initialized
✔ Nitro Server built in 64ms nitro 11:15:07 AM
[1] 85536 segmentation fault pnpm dev
Expected Result
No seg fault
Actual Result
➜ nitro-app git:(main) ✗ p dev
> nitro-app@ dev /Users/max/graphed/nitro-app
> nitro dev
➜ Local: http://localhost:3000/
➜ Network: use --host to expose
✔ Nitro Server built in 150ms nitro 11:14:59 AM
Sentry plugin initialized
✔ Nitro Server built in 71ms nitro 11:15:04 AM
Sentry plugin initialized
✔ Nitro Server built in 64ms nitro 11:15:07 AM
[1] 85536 segmentation fault pnpm dev
Additional Context
No response
Priority
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.
maxchehab and dts
Metadata
Metadata
Assignees
Projects
Status
Waiting for: Product Owner