Tim Fish
Tim Fish9mo ago

Sentry - monkey patching globals?

I'm working with Sentry to release a Deno SDK. To capture breadcrumbs and tracing for console/fetch etc, Sentry monkey patch these globals. Last time I tried, shortly after v1 this worked but trying with the latest release, this no longer works. Testing further I can monkey patch globals but it seems to be isolated to the module/file where I do the patching. Is this expected behaviour? Have there been changes to restrict monkey patching globals?
4 Replies
Deno AI Helper
Deno AI Helper9mo ago
Based on the documentation, it doesn't provide a clear answer to your question about monkey patching globals in Deno. It's important to note that Deno is designed to be a secure runtime for JavaScript and TypeScript, and it isolates scripts from the system unless explicitly allowed, which might affect the behavior of monkey patching. However, without specific information in the documentation about this topic, I can't provide a definitive answer. If you're having technical issues with this, it might be helpful to provide a minimal code example that reproduces the problem. This could help in identifying if the issue is a bug or an intended behavior. Also, consider checking the release notes of the versions between your last successful attempt and the latest release to see if there were any changes that might affect this. Remember to always test your code thoroughly when monkey patching, as it can lead to unpredictable behavior and make debugging more difficult. 🦕
Tim Fish
Tim Fish9mo ago
GitHub
Support for Deno server · Issue #3009 · getsentry/sentry-javascript
Summary SDK For https://deno.land/ A Deno SDK would require Sentry provides a package which follows the spec upon which Deno applications are built. Essentially it is based on a non-node JS runtime...
Tim Fish
Tim Fish9mo ago
GitHub
feat(ext/node): properly segregate node globals by lucacasonato · P...
Code run within Deno-mode and Node-mode should have access to a slightly different set of globals. Previously this was done through a compile time code-transform for Node-mode, but this is not idea...
lcasdev
lcasdev9mo ago
@Tim Fish you should only run into this for console fetch is not environment isolated