Deployments

Logging and Diagnostics

Production diagnostics should answer which route failed, how long it took, and which adapter path handled it without leaking user data.

Request logs

Use compact request logs for local smoke checks and production request summaries.

mreact-router dev --log=requests
mreact-router start .mreact --log=requests
MREACT_ROUTER_LOG=requests mreact-router start .mreact

Each line includes method, path, status, duration, and runtime. Request logs intentionally omit query strings, headers, cookies, and bodies. Do not log cookies, authorization headers, form bodies, uploaded file names, access tokens, session IDs, CSRF tokens, or raw search params that may contain private data.

Trace context and instrumentation

Mreact accepts W3C traceparent and tracestate headers and forwards parsed trace context to router instrumentation hooks. Use instrumentation when you need request start/end, route timing, middleware timing, loader timing, or adapter-specific spans.

import { startServer } from "@reckona/mreact-router";

await startServer({
  instrumentation: {
    onRequestStart(event) {
      recordSpanStart(event.trace);
    },
    onRequestEnd(event) {
      recordSpanEnd({
        path: event.path,
        status: event.status,
        trace: event.trace,
      });
    },
  },
  outDir: ".mreact",
  port: Number(process.env.PORT ?? 3001),
});

Keep instrumentation payloads structured and small. If a log line needs request data, record stable IDs and route paths rather than full URLs or headers.

Custom integrations that call renderAppRequest() directly can pass onRenderError(error) to observe a route render failure before Mreact renders the matching error boundary response. Use it for structured error reporting, and keep the captured payload free of request headers, cookies, form bodies, and raw URLs unless your application has already scrubbed them.

AWS Lambda timings

For AWS Lambda latency work, enable adapter timings temporarily and inspect request conversion, runtime materialization, middleware, loader, render, and response conversion phases. AWS Lambda cold starts are sensitive to route preload choices, so compare the same route and the same memory size before and after changing preload.

Deployment smoke checks

  • Verify 200, redirect, 404, and error responses through the deployed origin.
  • Confirm request logs include runtime and status but no sensitive request data.
  • Confirm traceparent propagation when an upstream gateway or observability platform injects it.
  • Capture failed route path, status, adapter runtime, and release identifier.
  • Pair release identifiers with Source Maps for client stack trace symbolication.