DataDog / dd-trace-js

JavaScript APM Tracer
https://docs.datadoghq.com/tracing/
Other
656 stars 309 forks source link

Support: Express v5 #4704

Open vernak2539 opened 2 months ago

vernak2539 commented 2 months ago

Hello there! Express v5 was just released. It'd be great if we could get support for this as we're encountering errors when running with dd-trace instrumented.

I've tried to put a bunch of information below, but let me know if more is needed.

I saw this old issue from a while ago, but felt it would be better to submit a new one as v5 is now out!

Extra Information

We run our app using this command:

node -r ./.env/development.cjs --import ./src/node-instrumentation.mjs .

The ./src/node-instrumentation.mjs looks something like this:

import tracer from 'dd-trace';

const hostname = process.env.STATSD_HOST;

if (hostname) {
  tracer.init({
    hostname: process.env.STATSD_HOST,
    service: appName,
    debug: process.env.DATADOG_DEBUG_ENABLED === 'true',
  });
  tracer.use('express', {
    service: `${appName}/express`,
    hooks: {
        // hook stuff, nothing too interesting other than setting span tags
      },
    },
  });
  tracer.use('http', { service: `${appName}/http-client` });
  tracer.use('dns', { service: `${appName}/dns` });
  tracer.use('net', { service: `${appName}/tcp` });
}

This is the error we get when running the application.

TypeError: Cannot read properties of undefined (reading 'fast_star')
    at isFastStar (/Users/testuser/repo/node_modules/dd-trace/packages/datadog-instrumentations/src/router.js:124:22)
    at Object.test (/Users/testuser/repo/node_modules/dd-trace/packages/datadog-instrumentations/src/router.js:116:17)
    at errorMiddleware (/Users/testuser/repo/node_modules/dd-trace/packages/datadog-instrumentations/src/router.js:39:27)
    at errorMiddleware (/Users/testuser/repo/node_modules/dd-trace/packages/datadog-shimmer/src/shimmer.js:31:21)
    at Layer.handleError (/Users/testuser/repo/node_modules/router/lib/layer.js:113:17)
    at trimPrefix (/Users/testuser/repo/node_modules/router/index.js:335:13)
    at /Users/testuser/repo/node_modules/router/index.js:295:9
    at processParams (/Users/testuser/repo/node_modules/router/index.js:575:12)
    at next (/Users/testuser/repo/node_modules/router/index.js:289:5)
    at Layer.handleError (/Users/testuser/repo/node_modules/router/lib/layer.js:122:5)
    at trimPrefix (/Users/testuser/repo/node_modules/router/index.js:335:13)
    at /Users/testuser/repo/node_modules/router/index.js:295:9
    at processParams (/Users/testuser/repo/node_modules/router/index.js:575:12)
    at next (/Users/testuser/repo/node_modules/router/index.js:289:5)
    at Layer.handleError (/Users/testuser/repo/node_modules/router/lib/layer.js:108:12)
    at trimPrefix (/Users/testuser/repo/node_modules/router/index.js:335:13)
    at /Users/testuser/repo/node_modules/router/index.js:295:9
    at processParams (/Users/testuser/repo/node_modules/router/index.js:575:12)
    at next (/Users/testuser/repo/node_modules/router/index.js:289:5)
    at Layer.handleError (/Users/testuser/repo/node_modules/router/lib/layer.js:108:12)
    at trimPrefix (/Users/testuser/repo/node_modules/router/index.js:335:13)
    at /Users/testuser/repo/node_modules/router/index.js:295:9
    at processParams (/Users/testuser/repo/node_modules/router/index.js:575:12)
    at next (/Users/testuser/repo/node_modules/router/index.js:289:5)
    at Layer.handleError (/Users/testuser/repo/node_modules/router/lib/layer.js:108:12)
    at trimPrefix (/Users/testuser/repo/node_modules/router/index.js:335:13)
    at /Users/testuser/repo/node_modules/router/index.js:295:9
    at processParams (/Users/testuser/repo/node_modules/router/index.js:575:12)
    at next (/Users/testuser/repo/node_modules/router/index.js:289:5)
    at Layer.handleError (/Users/testuser/repo/node_modules/router/lib/layer.js:108:12)
    at trimPrefix (/Users/testuser/repo/node_modules/router/index.js:335:13)
    at /Users/testuser/repo/node_modules/router/index.js:295:9
    at processParams (/Users/testuser/repo/node_modules/router/index.js:575:12)
    at next (/Users/testuser/repo/node_modules/router/index.js:289:5)
    at Layer.handleError (/Users/testuser/repo/node_modules/router/lib/layer.js:108:12)
    at trimPrefix (/Users/testuser/repo/node_modules/router/index.js:335:13)
    at /Users/testuser/repo/node_modules/router/index.js:295:9
    at processParams (/Users/testuser/repo/node_modules/router/index.js:575:12)
    at next (/Users/testuser/repo/node_modules/router/index.js:289:5)
    at Layer.handleError (/Users/testuser/repo/node_modules/router/lib/layer.js:108:12)
    at trimPrefix (/Users/testuser/repo/node_modules/router/index.js:335:13)
    at /Users/testuser/repo/node_modules/router/index.js:295:9
    at processParams (/Users/testuser/repo/node_modules/router/index.js:575:12)
    at next (/Users/testuser/repo/node_modules/router/index.js:289:5)
    at Layer.handleError (/Users/testuser/repo/node_modules/router/lib/layer.js:108:12)
    at trimPrefix (/Users/testuser/repo/node_modules/router/index.js:335:13)
    at /Users/testuser/repo/node_modules/router/index.js:295:9
    at processParams (/Users/testuser/repo/node_modules/router/index.js:575:12)
    at next (/Users/testuser/repo/node_modules/router/index.js:289:5)
    at Layer.handleRequest (/Users/testuser/repo/node_modules/router/lib/layer.js:154:5)
Vakintoshka commented 1 month ago

Hey everyone,

Are there any updates or plans to include this in the roadmap? Our security audit requires us to move from express@5-beta to the stable express@5 release, but we’re currently facing compatibility issues with dd-trace.

Any guidance or updates would be greatly appreciated!

rhyschard commented 1 month ago

We are running into the same issue, any updates? Express 5.0.1..