Skip to content

fix(hono): Make the Hono middleware types compile on Hono 5 - #25452

Open
s1gr1d wants to merge 3 commits into
developfrom
sig/hono-5--1-types
Open

s1gr1d wants to merge 3 commits into
developfrom
sig/hono-5--1-types

Conversation

@s1gr1d

@s1gr1d s1gr1d commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

On Hono 5, app.use(Sentry.honoMiddleware(app)) fails with "TS2769: No overload matches this call". Hono 5 removes c.req.matchedRoutes and c.req.routePath (honojs/hono#5500), but our vendored HonoRequest type in honoTypes.ts required both.

  • matchedRoutes is now optional, and routePath is gone (SDK never reads it)
  • New type tests run against Hono 4 and the Hono 5 RC (test/types.test-d.ts)
  • The hono-4 and hono-4-legacy E2E apps type-check their SDK calls in test:build
  • A lint rule blocks hono imports in @sentry/server-utils.

Ref: #25223

Hono 5 removes c.req.matchedRoutes and c.req.routePath. The vendored HonoRequest type
required both, so app.use(honoMiddleware(app)) failed with TS2769 on Hono 5. Make
matchedRoutes optional and drop routePath, which the SDK does not read.

Add Vitest type tests against Hono 4 and a pinned Hono 5 release candidate, a type
check of the SDK calls in the Hono 4 E2E apps, and a lint rule that keeps hono
imports out of @sentry/server-utils. Pin the hono devDependency of @sentry/hono to
4.13.9, so the package no longer builds against the hoisted version by chance.

Refs #25223
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@s1gr1d
s1gr1d added this pull request to stack #25455 October 16, 2026 12:14
@s1gr1d
s1gr1d marked this pull request as ready for review October 16, 2026 12:20
@s1gr1d
s1gr1d requested review from a team as code owners October 16, 2026 12:20
@s1gr1d
s1gr1d requested review from chargome, isaacs and mydea and removed request for a team October 16, 2026 12:20
@s1gr1d
s1gr1d marked this pull request as draft October 16, 2026 12:21
@s1gr1d
s1gr1d marked this pull request as ready for review October 16, 2026 12:22
s1gr1d and others added 2 commits October 16, 2026 14:28
The hono devDependency of @sentry/hono (4.13.9) and the integration tests (^4.13.7)
resolved to two Hono copies. Their HonoRequest types differ by a unique symbol, so
sentry(app) did not type-check in the bun and cloudflare integration tests, and
yarn dedupe-deps:check failed. Resolve both to 4.13.9.

Refs #25223
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant