Node / Edge SDK

Direct infrastructure-level instrumentation for your backend or edge computing functions using the official `@probebrowser/trace-node` SDK.

Installation

$
npm install @probebrowser/trace-node

Core Concepts

Manual Tracing

You can manually wrap logic blocks in a trace span. All logs, assertions, and exceptions thrown within the scoped closure are natively synced with the dashboard trace.

import { Trace } from '@probebrowser/trace-node';

await Trace.instrument('ProcessPayment', async (span) => {
  span.setTag('userId', '12354');

  const result = await chargeStripe();
  span.log('Charge completed', result);

  return result;
});

Next.js App Router Wrapper

Instrumenting Edge runtimes or Server Actions in Next.js relies on the `withTrace` HOC bindings to preserve context through V8 isolates.

import { withTrace } from '@probebrowser/trace-node/next';

export const POST = withTrace(async (req) => {
  const data = await req.json();
  // Unhandled errors here will be automatically traced
  // and linked via causal tracing.
  return Response.json({ success: true });
});