Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Sentry 11 min read Case study mediumAdept

Digging better tunnels: keeping Sentry events from getting lost to ad blockers

Sentry's JavaScript SDKs (v11.13+) now route browser events around ad blockers through a same-origin tunnel enabled with `tunnel: true` in the browser and `serveTunnelIntegration` on the server. The tunnel path is a 32-bit FNV-1a hash of the DSN, which keeps browser and server in sync without shared build steps and avoids the drift that per-build random paths caused. Requests are intercepted at the runtime entry point (node:http, Bun/Deno serve, Workers, Lambda) so auth and CSRF middleware can't reject them first, with a generated route file as a Vercel/Next.js workaround. The handler acts as an allowlist, not an open proxy: it forwards only allowed DSNs, reads just the envelope's first line before deciding, forwards visitor IP and user agent but drops cookies, and handles HTTP/2 pseudo-header and Host-parsing crashes.

Assumes: HTTP request handlingNode.js middlewareJavaScript bundlers

Related posts

  • Sentry JavaScript SDK v11 adds tracing for all JS platforms

    Sentry mediumAdept

    Sentry's JavaScript SDK v11 replaces OpenTelemetry export-patching instrumentations (require-in-the-middle, import-in-the-middle, shimmer) with a source-code transformer that injects node:diagnostics_channel tracingChannel calls into library functions, plus integrations that subscribe to those channels and emit Sentry spans. Because the transform rewrites source rather than mutating exports, it runs both at runtime via Module.registerHooks and at build time via Vite, Rollup, webpack, esbuild and bun build plugins. That makes bundled deployments, Cloudflare Workers, Deno and Bun traceable and removes preload hacks and most OpenTelemetry dependencies. Caveats: load order still matters, --require is dropped, instrumented libraries must not be externalized, Bun runtime hooks are blocked by a CJS export bug, and debug: true reports what got injected.

  • March 2 incident update

    Deno mediumAdept

    A 98-minute outage of deno.land media, deno.land/x and deno.land/std module serving, doc.deno.land and cdn.deno.land was caused by a faulty Cloudflare abuse-prevention filter. A traffic spike from the Deno 1.8 Hacker News post triggered a TOS media block, and Cloudflare treated every .ts file as an MPEG transport stream, even though the files were served as application/typescript. Deno moved its Cloudflare Worker to a Deno script on Fly.io in under 20 minutes by polyfilling the fetch event, then switched DNS. Cloudflare lifted the block 16.5 hours later. Users with cached dependencies were largely unaffected; new users and CI pipelines bore the impact. A public status page followed.

  • Bun v1.4.1

    Bun mediumAdept

    Bun v1.4.1 fixes 202 issues and ships runtime, install and bundler improvements. JavaScriptCore now discards JIT code after idle periods, sharply cutting RSS (Next.js SSR 222 MB to 142 MB), and Bun.serve gains HTTP/2 on the same port via ALPN with large throughput gains over node:http2. Buffer read/write methods are JIT-inlined (up to 9x faster), AsyncLocalStorage avoids per-await allocations, Bun.write streams response bodies to disk, and WebSocket gets pause/resume for TCP backpressure. fetch now verifies TLS against the URL hostname rather than the Host header, closing an insecure default. bun build tree-shakes through `export * as` and dynamic import(), shrinking zod bundles by about 79%.

  • How to use Google Analytics in Deno Deploy

    Deno mediumAdept

    Server-side Google Analytics on Deno Deploy sidesteps ad blockers, which Deno says over 70% of its audience uses, and gives more reliable tracking than the client-side snippet. The g_a module offers createReporter, which logs each request, response, timing and error from a std/http serve handler, and createReportMiddleware for oak apps. The tracking ID can be passed in code or set as the GA_TRACKING_ID environment variable in Deploy settings. The module supports only the now-retired Universal Analytics, with GA4 and event support under investigation.

  • Bun v1.3.4

    Bun mediumAdept

    Bun 1.3.4 adds the URLPattern Web API (passing 408 Web Platform Tests), Jest-style fake timers in bun:test, custom proxy headers in fetch() and a %j console format specifier. It also fixes three separate bugs that stopped http.Agent keepAlive from reusing connections, including case-sensitive header parsing that violated RFC 7230. Standalone executables built with --compile no longer load tsconfig.json or package.json at runtime unless you opt back in with new flags. Other changes update bun:sqlite to SQLite 3.51.1, tighten chunk-terminator validation per RFC 9112, and fix many fuzzer-found crashes in Buffer, FFI, Node.js compatibility and Windows behaviour.

The quest for software engineering knowledge.

Look:
Layout: