Repository navigation
Conversation
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
added this pull request to stack #25455
October 16, 2026 12:14
Contributor
size-limit report 📦
|
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>
The Context hook and wrapSubAppMiddleware each had their own copy of the rule that tells middleware from route handlers. Move the rule to getMiddlewareFlags() and check the shape of the match result entries before the hook reads them. No behavior change. Refs #25223 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Hono 5 removes c.req.matchedRoutes, so every request was named "GET ". It also restores c.req.routeIndex after next(), so the Sentry middleware can no longer see which handler responded. Read the match result through the getter that hono/route uses, and let each route handler record its routeIndex when it starts. A request with no matched route keeps the runtime's span name. On Hono 4 the names stay the same, except where the old rule picked a later catch-all, for example for a route handler declared with an unused next parameter. Refs #25223 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Name the span when a route handler starts, so events captured in the handler get its route. - Fall back to the first matched route handler, then to a middleware path. A request without a route keeps the runtime name. - Wrap route handlers only when one of them declares `next`.
s1gr1d
added a commit
that referenced
this pull request
Oct 23, 2026
Preparation for #25454. No behavior change. - The Context hook and `wrapSubAppMiddleware` had their own copies of the rule that tells middleware from route handlers. Both now call `getMiddlewareFlags()` - The hook checks the shape of the match result entries once (`isMatchedHandlerList()`), instead of optional chaining at each step Ref #25223 --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On Hono 5, every request got the span name
GETand an emptyhttp.route. With this PR, names look the same as on Hono 4:GET /users/:id, withhttp.routeset to/users/:id.Why they broke:
c.req.matchedRoutes.composeresetsc.req.routeIndexafternext()(honojs/hono#4424), so the Sentry middleware cannot see which handler responded.How the name is built now:
hono/routeuses (matchResult.ts).next(and can pass the request on), the SDK wraps the route handlers, so the handler that starts last renames the span.Small changes on Hono 4 too: events captured in a handler get that handler's route (not a later catch-all), and a 404 keeps the runtime name
GETinstead ofGET /*.Refs #25223