dd-trace-js icon indicating copy to clipboard operation
dd-trace-js copied to clipboard

dd-trace v5.22.0 requiring graphql?

Open dylan-jaris opened this issue 1 year ago • 3 comments

Hello,

GH dependabot has made a PR in my repo to update dd-trace from v5.21.0 to v5.22.0. Checking out the feature branch locally, I'm met with these errors on app startup stating that dd-trace could not resolve these graphql packages. Is this correct?? Is dd-trace now requiring graphql? 364076623-f3582640-694d-4152-8519-1d09d66c5141

dylan-jaris avatar Sep 03 '24 18:09 dylan-jaris

+1 this is an issue with all of our typescript projects... I have added graphql as a devDependency in the mean time to get them to build. Should graphql be a dependency instead?

Romack avatar Sep 19 '24 17:09 Romack

The project does not depend on graphql however static analysis tools will discover the packages/datadog-plugin-graphql/src/tools/transforms.js file and the following lines and then freak out:

const visitor_1 = require("graphql/language/visitor");
const printer_1 = require("graphql/language/printer");
const utilities_1 = require("graphql/utilities");

Does anyone have recommendations on how to prevent such tools from parsing the requires? E.g. is there something we can do with string concatenation?

const visitor_1 = require("graphq" + "l/language/visitor");

This sometimes affects users with esbuild projects, too.

tlhunter avatar Oct 03 '24 23:10 tlhunter

Funny enough nothing really changed with that file between those two versions of the tracer. Did anything else with your setup change, like the version of TypeScript? The esbuild issue I mentioned has been happening for ages.

tlhunter avatar Oct 03 '24 23:10 tlhunter

@Romack @dylan-jaris could you please share your setup that creates the issue? We could try to find ways around the detection in that case.

BridgeAR avatar Jun 24 '25 00:06 BridgeAR