Skip to content

[BUG]: RangeError: Maximum call stack size exceeded #6269

@andresemartinez

Description

@andresemartinez

Tracer Version(s)

5.57.1

Node.js Version(s)

v22.17.0

Bug Report

I have a project using dd-trace with the mysql2 plugin, bundled with esbuild, and I get the following error at runtime:

RangeError: Maximum call stack size exceeded
    at node:diagnostics_channel:83:10
    at Channel.runStores (node:diagnostics_channel:171:12)
    at t.onResult (/opt/datadog/apm/library/js/node_modules/dd-trace/packages/datadog-instrumentations/src/mysql2.js:113:34)
    at run (node:diagnostics_channel:162:14)
    at DatadogStorage.run (/opt/datadog/apm/library/js/node_modules/dd-trace/packages/datadog-core/src/storage.js:79:22)
    at node:diagnostics_channel:94:18
    at Channel.runStores (node:diagnostics_channel:171:12)
    at t.onResult (/opt/datadog/apm/library/js/node_modules/dd-trace/packages/datadog-instrumentations/src/mysql2.js:113:34)
    at run (node:diagnostics_channel:162:14)
    at DatadogStorage.run (/opt/datadog/apm/library/js/node_modules/dd-trace/packages/datadog-core/src/storage.js:79:22)

This only happens if the mysql2 is present, if not it works fine. This are the versions of the dependencies:

  • dd-trace: 5.57.1
  • mysql2: 3.14.1
  • esbuild: 0.23.1

and this is the build.mjs script I'm using:

import ddPlugin from "dd-trace/esbuild.js";

import esbuild from "esbuild";

await esbuild.build({
  entryPoints: ["./src/app.ts"],
  bundle: true,
  minify: true,
  sourcemap: true,
  tsconfig: "tsconfig.build.json",
  platform: "node",
  target: "es2022",
  outdir: "dist",
  logLevel: "info",
  plugins: [ddPlugin],
  external: [
    "graphql/language/visitor",
    "graphql/language/printer",
    "graphql/utilities",
  ],
});

Reproduction Code

No response

Error Logs

RangeError: Maximum call stack size exceeded
    at node:diagnostics_channel:83:10
    at Channel.runStores (node:diagnostics_channel:171:12)
    at t.onResult (/opt/datadog/apm/library/js/node_modules/dd-trace/packages/datadog-instrumentations/src/mysql2.js:113:34)
    at run (node:diagnostics_channel:162:14)
    at DatadogStorage.run (/opt/datadog/apm/library/js/node_modules/dd-trace/packages/datadog-core/src/storage.js:79:22)
    at node:diagnostics_channel:94:18
    at Channel.runStores (node:diagnostics_channel:171:12)
    at t.onResult (/opt/datadog/apm/library/js/node_modules/dd-trace/packages/datadog-instrumentations/src/mysql2.js:113:34)
    at run (node:diagnostics_channel:162:14)
    at DatadogStorage.run (/opt/datadog/apm/library/js/node_modules/dd-trace/packages/datadog-core/src/storage.js:79:22)

Tracer Config

No response

Operating System

Alpine 3.21

Bundling

ESBuild

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions