Skip to content

fix: file-type dep mismatch version on node_modules override#1870

Merged
aleortega merged 1 commit intomainfrom
fix/deps-mismatch-version
Feb 6, 2026
Merged

fix: file-type dep mismatch version on node_modules override#1870
aleortega merged 1 commit intomainfrom
fix/deps-mismatch-version

Conversation

@aleortega
Copy link
Contributor

@aleortega aleortega commented Feb 6, 2026

Description

The GET /content/contents/:id endpoint was failing on most requests with:

TypeError: buf.readInt32BE is not a function
      at Object.get
  (node_modules/file-type/node_modules/token-types/lib/index.js:156:20)

Root cause:
The Dockerfile merges dependencies by copying content/node_modules/ into the root node_modules/. This overlay replaces file-type@15 (a root workspace dependency) with file-type@21 (content's dependency), but leaves behind the stale nested node_modules/file-type/node_modules/token-types@2.1.1 from the old version. At runtime, file-type@21 resolves token-types to this stale v2.1.1 (CJS, uses Buffer.readInt32BE) instead of the correct v6.1.1 (ESM, uses DataView with Uint8Array), causing the crash.

Fix:
Remove file-type@15 from root node_modules/ before overlaying content's dependencies, ensuring file-type@21 is installed cleanly without stale nested dependencies

@aleortega aleortega force-pushed the fix/deps-mismatch-version branch from c9b1ac9 to 5d688ac Compare February 6, 2026 17:06
@aleortega aleortega force-pushed the fix/deps-mismatch-version branch from 5d688ac to 63521b4 Compare February 6, 2026 17:25
@aleortega aleortega marked this pull request as ready for review February 6, 2026 17:26
@aleortega aleortega enabled auto-merge (squash) February 6, 2026 17:34
@aleortega aleortega merged commit 1a5d6a8 into main Feb 6, 2026
8 checks passed
@aleortega aleortega deleted the fix/deps-mismatch-version branch February 6, 2026 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants