Skip to content

Tracing with Node + tsx doesn't currently work #14198

@fabianhjr-dealengine

Description

@fabianhjr-dealengine

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.37.1

Framework Version

N/A

Link to Sentry event

No response

Reproduction Example/SDK Setup

Node v20.18.0
NPM v10.8.2

package.json

{
  "devDependencies": {
    "@sentry/node": "^8.37.1",
    "@sentry/profiling-node": "^8.37.1",
    "tsx": "^4.19.2"
  }
}

sentry-init.cjs

const Sentry = require('@sentry/node');
const { nodeProfilingIntegration } = require('@sentry/profiling-node');

Sentry.init({
    dsn: process.env.SENTRY_DSN,
    integrations: [
        nodeProfilingIntegration()
    ],
    environment: process.env.SENTRY_ENVIRONMENT,
    tracesSampleRate: 1.0,
    profilesSampleRate: 1.0,
    attachStacktrace: true,
    autoSessionTracking: true,
});

console.debug('Sentry initialized with environment:', process.env.SENTRY_ENVIRONMENT);

sentry-trace-repro.ts

import * as Sentry from '@sentry/node';

Sentry.startSpanManual({ name: 'Span test' }, (span) => {
    console.log('span start')
    setTimeout(() => {
        console.log('span end')
        span.end()
    }, 3000);
});

Sentry.captureException(new Error('Test error'));

Steps to Reproduce

node --require ./sentry-init.cjs --import tsx sentry-trace-repro.ts

Test error is sent but span isn't, this is a smaller reproducer than express but use case is an app.ts with express running.

Expected Result

Span/Transaction on sentry

Actual Result

No span/transaction on sentry

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugPackage: nodeIssues related to the Sentry Node SDK

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions