From c94723e200d9b6f9a763457bcf9a6574add0ae60 Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Wed, 2 Jul 2025 14:21:09 +0200 Subject: [PATCH 1/2] fix(node): Avoid using dynamic `require` for fastify integration Not sure why we even have this, but this somehow breaks cloudflare-pages E2E tests in some scenarios. It also seems simply unnecessary. --- .../integrations/tracing/fastify/fastify-otel/index.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/packages/node/src/integrations/tracing/fastify/fastify-otel/index.js b/packages/node/src/integrations/tracing/fastify/fastify-otel/index.js index d4f0638cb30a..46ba1858491f 100644 --- a/packages/node/src/integrations/tracing/fastify/fastify-otel/index.js +++ b/packages/node/src/integrations/tracing/fastify/fastify-otel/index.js @@ -30,7 +30,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* eslint-disable @typescript-eslint/explicit-member-accessibility */ /* eslint-disable jsdoc/require-jsdoc */ /* eslint-disable max-lines */ /* eslint-disable no-param-reassign */ @@ -44,6 +43,7 @@ import { ATTR_HTTP_ROUTE, ATTR_SERVICE_NAME, } from '@opentelemetry/semantic-conventions'; +import { minimatch } from 'minimatch'; // SENTRY VENDOR NOTE // Instead of using the package.json file, we hard code the package name and version here. @@ -97,18 +97,12 @@ export class FastifyOtelInstrumentation extends InstrumentationBase { throw new TypeError('ignorePaths must be a string or a function'); } - let globMatcher = null; + const globMatcher = minimatch; this[kIgnorePaths] = routeOptions => { if (typeof ignorePaths === 'function') { return ignorePaths(routeOptions); } else { - // Using minimatch to match the path until path.matchesGlob is out of experimental - // path.matchesGlob uses minimatch internally - if (globMatcher == null) { - globMatcher = require('minimatch').minimatch; - } - return globMatcher(routeOptions.url, ignorePaths); } }; From ea04d1b234fe461ae96062881ae44dbfbf1accf9 Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Wed, 2 Jul 2025 14:34:49 +0200 Subject: [PATCH 2/2] use namespace import --- .../src/integrations/tracing/fastify/fastify-otel/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/node/src/integrations/tracing/fastify/fastify-otel/index.js b/packages/node/src/integrations/tracing/fastify/fastify-otel/index.js index 46ba1858491f..334223d697a5 100644 --- a/packages/node/src/integrations/tracing/fastify/fastify-otel/index.js +++ b/packages/node/src/integrations/tracing/fastify/fastify-otel/index.js @@ -43,7 +43,7 @@ import { ATTR_HTTP_ROUTE, ATTR_SERVICE_NAME, } from '@opentelemetry/semantic-conventions'; -import { minimatch } from 'minimatch'; +import * as minimatch from 'minimatch'; // SENTRY VENDOR NOTE // Instead of using the package.json file, we hard code the package name and version here. @@ -97,7 +97,7 @@ export class FastifyOtelInstrumentation extends InstrumentationBase { throw new TypeError('ignorePaths must be a string or a function'); } - const globMatcher = minimatch; + const globMatcher = minimatch.minimatch; this[kIgnorePaths] = routeOptions => { if (typeof ignorePaths === 'function') {