Skip to content

Windows: module path separator causes getTransformer to fail (backslash vs forward slash) #19

Description

@hevets

Problem: On Windows, module-details-from-path uses path.sep () to reconstruct relative paths, producing values like lib\tools.js. The getTransformer() WASM function compares these against filePath values in instrumentation configs which use forward slashes (lib/tools.js). The strict comparison fails, causing all subscriber-based instrumentation to silently return no transformer.

Affected: All orchestrion-based instrumentation on Windows (pino, express, ioredis, pg, etc.)

Affected versions: All versions of tracing-hooks (v0.0.1 through v0.4.0)

Suggested fix: Normalize resolvedModule.path before passing to getTransformer() in index.js (inside wrappedCompile):

const normalizedPath = resolvedModule.path.replace(/\\/g, '/')
const transformer = self.instrumentator.getTransformer(resolvedModule.name, version, normalizedPath)

Alternative: The fix could be applied inside the WASM getTransformer in @apm-js-collab/code-transformer to normalize paths before comparison.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions