Skip to content

@tsed/platform-http missing explicit dependency on encodeurl #3248

Description

@ueberBrot

Describe the bug

The package @tsed/platform-http imports and uses the encodeurl library in PlatformResponse.ts, but encodeurl is not listed in the dependencies section of its package.json.

This causes build/test failures in strict environments (like Bun or pnpm) where "phantom dependencies" are not allowed, or when @tsed/platform-http is used without @tsed/platform-express (which usually hoists encodeurl).

References:

To Reproduce

To Reproduce

  1. Initialize a project using a strict package manager like Bun or pnpm.
  2. Install @tsed/platform-http (ensure @tsed/platform-express is not installed, as it masks the issue by hoisting the dependency).
  3. Run any code or test that initializes PlatformResponse.
  4. See error: Error: Cannot find package 'encodeurl'

Expected behavior

@tsed/platform-http should be self-contained. When installed in isolation or in strict environments (like Bun or pnpm), it should correctly resolve its own internal imports without requiring the user to manually install transient dependencies like encodeurl.

Code snippets

Import in PlatformResponse.ts:
import encodeUrl from "encodeurl";
// ...
item = encodeUrl(String(item));
Resulting Error:
Error: Cannot find package 'encodeurl' imported from .../@tsed/platform-http/lib/esm/common/services/PlatformResponse.js

Repository URL example

https://github.com/tsedio/tsed/blob/production/packages/platform/platform-http/src/common/services/PlatformResponse.ts#L6

OS

macOS / Linux (CI)

Node version

v22.19.0

Library version

v8.24.0

Additional context

This issue was identified in a Bun monorepo. It was initially hidden locally because a previous installation of express had hoisted encodeurl into the global cache. After running bun pm cache clean and a fresh bun install, the error became consistently reproducible. This highlights that @tsed/platform-http currently relies on other packages (like platform-express) to accidentally provide its dependencies.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions