-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose node/deno global to the other mode #20826
Comments
They are the same global. Depending on whether you access it from "deno code" or "node code" you'll receive different values for certain properties (such as
I assume you are trying to instrument |
Yes, we're trying instrument The |
Fetch should be unaffected by this - please check that the reason it is not working is not for other reasons. Right now, what I can suggest you do is the following: // in an npm module
import { readDenoGlobal, writeDenoGlobal } from "data:application/javascript,export function readDenoGlobal(key) { return globalThis[key] }; export function writeDenoGlobal(key, value) { globalThis[key] = value; }";
function readNodeGlobal(key) {
return globalThis[key];
}
function writeNodeGlobal(key, value) {
globalThis[key] = value;
} This little hack works because the functions defined in the |
We're attempting to publish a Deno specific Sentry SDK.
The Sentry SDK currently saves state to
globalThis
and monkey patchesconsole
/fetch
to instrument these but changes earlier this year to segregate globals has complicated things.If we publish an npm-only Deno SDK, we don't have access to instrument the "deno-mode" global.
If we publish on deno.land, we won't have access to instrument the "node-mode" global.
It appears that the only way we can instrument both globals and capture breadcrumbs/spans for both deno/node code is to create a library that spans both modes!
It would be super helpful if we could access the global from the other mode.
Deno.global.deno
/Deno.global.node
?The text was updated successfully, but these errors were encountered: