Skip to content

SDK_VERSION is hardcoded and drifts from package.json in axios, fetch, node-http, langchain, and langchain-classic #603

Description

@teyrebaz33

Summary
Five packages send a hardcoded SDK_VERSION string to the Sapiom backend as part of requestFacts.sdk.version / sdkVersion telemetry, instead of reading it from package.json. All five have drifted from their actual published version:

Package Hardcoded SDK_VERSION Actual package.json version
@sapiom/axios "1.0.0" 0.5.1
@sapiom/fetch "1.0.0" 0.5.0
@sapiom/node-http "1.0.0" 0.4.1
@sapiom/langchain-classic "1.0.0" (×4 separate declarations, each tagged // TODO: Read from package.json) 0.5.1
@sapiom/langchain "0.4.1" (tagged // TODO: Read from package.json at build time) 0.5.1

Impact
This value is sent to Sapiom's transaction API on every request (requestFacts.sdk.version in packages/axios/src/interceptors.ts, packages/fetch/src/interceptors.ts, packages/node-http/src/interceptors.ts, and the LangChain equivalents). Since it never tracks the real package version, any version-based analytics, support triage, or deprecation logic on the backend that keys off this field is working from stale/wrong data for every user of these five packages — every axios/fetch/node-http user currently reports as "1.0.0" regardless of what they actually have installed.

Root cause
@sapiom/tools already solves this correctly: packages/tools/scripts/generate-version.mjs reads package.json at build/test/typecheck time and writes a gitignored src/_generated/version.ts with export const VERSION = <package.json version>, wired in via a gen:version npm script chained into build, test, test:coverage, test:watch, dev, and typecheck — so it can never go stale, including after a Changesets version bump. axios, fetch, node-http, langchain, and langchain-classic never adopted this pattern; they each just wrote a literal string, and in two of the five, a // TODO: Read from package.json comment shows the gap was already known but never closed.

Suggested fix
Apply the same generate-version.mjs / gen:version pattern already used by @sapiom/tools to the other five packages, and replace each hardcoded SDK_VERSION constant with an import from the generated file. Happy to open a PR — I already have this implemented and verified (build/test/typecheck/lint all clean, zero new test failures or lint issues in any of the five packages).

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