Repository navigation
fix(hono): skip publishing when env.incoming is missing - #8221
Merged
Merged
Conversation
Hono's testing helper `app.request()` and any non-node adapter call `app.fetch(request, undefined, undefined)`, so `env` and `context.env` are undefined. The wrappers dereferenced `env.incoming` unconditionally and threw `TypeError`. That throw is caught by the plugin's `addSub` wrapper, which logs and disables the hono plugin for the rest of the process — every CI Visibility run that loads dd-trace via `--import dd-trace/register.js` silently lost Hono APM coverage after the first `app.request()`. Each wrapper now reads `env?.incoming` once. When the IncomingMessage is absent there is no Node.js HTTP request to attach a span to, so the instrumentation skips publishing and `wrapMiddleware` short-circuits to the original middleware. Fixes: #8198
Contributor
🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage (details) 🔗 Commit SHA: 671f810 | Docs | Datadog PR Page | Give us feedback! |
Contributor
Overall package sizeSelf size: 5.68 MB Dependency sizes| name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.0.1 | 82.56 kB | 817.39 kB | | dc-polyfill | 0.1.10 | 26.73 kB | 26.73 kB |🤖 This report was automatically generated by heaviest-objects-in-the-universe |
BenchmarksBenchmark execution time: 2026-05-01 20:39:38 Comparing candidate commit 671f810 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 1744 metrics, 100 unstable metrics. |
IlyasShabi
approved these changes
May 4, 2026
Merged
BridgeAR
added a commit
that referenced
this pull request
May 4, 2026
Hono's testing helper `app.request()` and any non-node adapter call `app.fetch(request, undefined, undefined)`, so `env` and `context.env` are undefined. The wrappers dereferenced `env.incoming` unconditionally and threw `TypeError`. That throw is caught by the plugin's `addSub` wrapper, which logs and disables the hono plugin for the rest of the process — every CI Visibility run that loads dd-trace via `--import dd-trace/register.js` silently lost Hono APM coverage after the first `app.request()`. Each wrapper now reads `env?.incoming` once. When the IncomingMessage is absent there is no Node.js HTTP request to attach a span to, so the instrumentation skips publishing and `wrapMiddleware` short-circuits to the original middleware. Fixes: #8198
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.
Hono's testing helper
app.request()and any non-node adapter callapp.fetch(request, undefined, undefined), soenvandcontext.envare undefined. The wrappers dereferencedenv.incomingunconditionally and threwTypeError. That throw is caught by the plugin'saddSubwrapper, which logs and disables the hono plugin for the rest of the process — every CI Visibility run that loads dd-trace via--import dd-trace/register.jssilently lost Hono APM coverage after the firstapp.request().Each wrapper now reads
env?.incomingonce. When the IncomingMessage is absent there is no Node.js HTTP request to attach a span to, so the instrumentation skips publishing andwrapMiddlewareshort-circuits to the original middleware.Fixes: #8198