You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
deno: init() never registers the channel-injection hooks, though Deno supports them #23892
Deno 2.9.2 has a working Module.registerHooks, and hasStableSyncModuleHooks already returns true for Deno unconditionally (register.ts:20). Calling the register function directly works:
$ deno run -A reg.mjs
marker after register: {"runtime":[]} # hooks registered
But @sentry/deno's init() never calls it:
$ deno run -A nospans.mjs
orchestrion marker: undefined
Node's init() calls registerDiagnosticsChannelInjection() and then detectOrchestrionSetup(). Deno instead expects the user to remember deno run --import=@sentry/deno/import app.ts, and gives no warning at all if they forget. All 22 channel integrations still install and report Integration installed.
Work item. Call registerDiagnosticsChannelInjection() from @sentry/deno's init() behind the same enableRuntimeChannelInjection option Node uses, and call detectOrchestrionSetup() after client creation. Keep @sentry/deno/import working for the case where modules are imported before init().
**Prior art **(related history only). #21451 (merged) added the @sentry/deno/import runtime hook, and #22790 (merged) raised the floor to Deno >= 2.8.3, which is what makes the Module.registerHooks path safe to call unconditionally. No issue covers calling it from init().
I tried the straightforward fix for this, and it breaks Deno apps that don't grant env access, so I'd like to check the direction before opening a PR.
The fix mirrors what NodeClient does: call registerDiagnosticsChannelInjection() in the DenoClient constructor (behind the same __SENTRY_CHANNEL_INJECTION__ / enableRuntimeChannelInjection guards) and detectOrchestrionSetup() at the end of init(). Functionally it works. A scenario that calls init() and then imports mysql, with no --preload, gets the transformed module and __SENTRY_ORCHESTRION__.runtime is ["mysql"]. Before the change it was events= marker=null.
The catch is the static import of @sentry/server-runtime-injection/register. It pulls in the vendored debug package, which runs Object.keys(process.env) at module evaluation. So packages/deno/test/example.ts, run with only --allow-net, now dies on import:
error: Uncaught (in promise) NotCapable: Requires env access, run again with the --allow-env flag
exports.inspectOpts = Object.keys(process.env).filter(key => {
enableRuntimeChannelInjection: false doesn't help, since the crash happens before init() runs. tracing-hooks also reads process.env.TRACING_DUMP while transforming each module, so even without debug the hooks need env access once they are active. I assume this is why Deno currently opts in through --preload.
Two directions I can see:
Keep --preload=npm:@sentry/deno/import as the supported setup on Deno and make the missing case visible: an always-on warning from init() when channel integrations are installed but neither the runtime nor the bundler marker is set, plus a README section (the README doesn't mention the import hook today). Small and safe.
Make the injection package safe to import without env permission (stop the vendored debug from reading env at load, and guard the TRACING_DUMP reads), then register from init() as Node does. That gives Deno users what this issue asks for, but it touches the shared injection package and changes how its debug logging is enabled on Node.
@affanmomin Sorry for the delay circling back to this! Thanks for laying out the options.
I'd lean towards option 2. Making the two platforms more consistent with one another is the overarching goal here, and a env-touching debug feels like it's a bit unnecessary anyway.
If you've moved onto other things, no worries. I'll put it on my list to pick it up in the next few days if you don't. 👍
Activity
linear-code commentedon Sep 2, 2026
JS-3518
affanmomin commentedon Oct 4, 2026
I tried the straightforward fix for this, and it breaks Deno apps that don't grant env access, so I'd like to check the direction before opening a PR.
The fix mirrors what
NodeClientdoes: callregisterDiagnosticsChannelInjection()in theDenoClientconstructor (behind the same__SENTRY_CHANNEL_INJECTION__/enableRuntimeChannelInjectionguards) anddetectOrchestrionSetup()at the end ofinit(). Functionally it works. A scenario that callsinit()and then importsmysql, with no--preload, gets the transformed module and__SENTRY_ORCHESTRION__.runtimeis["mysql"]. Before the change it wasevents= marker=null.The catch is the static import of
@sentry/server-runtime-injection/register. It pulls in the vendoreddebugpackage, which runsObject.keys(process.env)at module evaluation. Sopackages/deno/test/example.ts, run with only--allow-net, now dies on import:enableRuntimeChannelInjection: falsedoesn't help, since the crash happens beforeinit()runs. tracing-hooks also readsprocess.env.TRACING_DUMPwhile transforming each module, so even withoutdebugthe hooks need env access once they are active. I assume this is why Deno currently opts in through--preload.Two directions I can see:
--preload=npm:@sentry/deno/importas the supported setup on Deno and make the missing case visible: an always-on warning frominit()when channel integrations are installed but neither the runtime nor the bundler marker is set, plus a README section (the README doesn't mention the import hook today). Small and safe.debugfrom reading env at load, and guard theTRACING_DUMPreads), then register frominit()as Node does. That gives Deno users what this issue asks for, but it touches the shared injection package and changes how its debug logging is enabled on Node.I'm happy to send either. Which would you prefer?
chargome commentedon Oct 5, 2026
Thanks for reaching out, we'll let @isaacs make the call here.
isaacs commentedon Oct 17, 2026
@affanmomin Sorry for the delay circling back to this! Thanks for laying out the options.
I'd lean towards option 2. Making the two platforms more consistent with one another is the overarching goal here, and a
env-touching debug feels like it's a bit unnecessary anyway.If you've moved onto other things, no worries. I'll put it on my list to pick it up in the next few days if you don't. 👍
feat(deno): Register channel injection hooks from `init()` (#25546)
github-actions commentedon Oct 23, 2026
A PR closing this issue has just been released 🚀
This issue was referenced by PR #25546, which was included in the 11.9.0 release.