feat(deno): Add orchestrion deno runtime hook#21451
Conversation
d6de7a3 to
0ceae6a
Compare
39be3da to
b34aa87
Compare
0ceae6a to
2011bb7
Compare
b34aa87 to
653fc0e
Compare
2011bb7 to
8ab5b64
Compare
JPeer264
left a comment
There was a problem hiding this comment.
LGTM, just two minor comments
| ``` | ||
|
|
||
| > [!NOTE] | ||
| > In Deno versions **2.8.0** through **2.8.2**, a bug causes Deno |
There was a problem hiding this comment.
q: Is it worth to mention that it works in these two versions? I would be fine of just saying we are supporting everything after 2.8.3 with the --import option and don't go into much detail - but this is also ok.
| * orchestrion runtime hook (`@sentry/deno/import`) needs to transform libraries | ||
| * like `mysql` so they publish to their tracing channels. | ||
| */ | ||
| export const MODULE_REGISTER_HOOKS_SUPPORTED = gte(2, 8, 0); |
There was a problem hiding this comment.
q/l: Connected to the other comment. Should we actually start supporting it form 2.8.3?
There was a problem hiding this comment.
I mean, it's fine, I guess? Probably no one's going to be using Deno 2.8.0, but they did make a big announcement about it when it came out, and haven't been as noisy about the patches, so it's possible someone upgraded right away, but then is lagging behind, I guess?
653fc0e to
8743326
Compare
8ab5b64 to
4f35ab9
Compare
b5a794a to
ac38662
Compare
4f35ab9 to
e54572f
Compare
size-limit report 📦
|
ac38662 to
0cfd982
Compare
e54572f to
21830a7
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 21830a7. Configure here.
0cfd982 to
ccbd1b2
Compare
Use the orchestrion loader hook defined in server-utils, and create a loader for Deno that detects the presence of the hooks, and instruments the channels added to the mysql module. Documentation added to call out the caveat of usage in Deno v2.8.0 through 2.8.2, which is fixed in 2.8.3.
21830a7 to
1caca4f
Compare
| * | ||
| * @module | ||
| */ | ||
| import '@sentry/server-utils/orchestrion/import-hook'; |
There was a problem hiding this comment.
Bug: The require() call for an orchestrion hook module is not wrapped in a try/catch, which can crash the application on Deno >= 2.8.0 if the module fails to load.
Severity: HIGH
Suggested Fix
Wrap the require('@apm-js-collab/tracing-hooks/hook-sync.mjs') call within a try/catch block. In the catch block, log a warning and gracefully disable the feature, similar to how unsupported platforms are handled.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: packages/deno/src/import.mjs#L30
Potential issue: When `@sentry/deno/import` is used on Deno versions 2.8.0 and higher,
the underlying code attempts to load `@apm-js-collab/tracing-hooks/hook-sync.mjs` using
`require()`. This call is not wrapped in a `try/catch` block. If the module fails to
load for any reason, such as a dependency resolution failure or an incompatibility with
Deno's Node.js compatibility layer, the unhandled exception will crash the application.
This behavior is inconsistent with the graceful fallback provided for older, unsupported
Deno versions.

Use the orchestrion loader hook defined in server-utils, and create a loader for Deno that detects the presence of the hooks, and instruments the channels added to the mysql module.
Documentation added to call out the caveat of usage in Deno v2.8.0 through 2.8.2, which is fixed in 2.8.3.