From d88bf7676e5fdb0fc2e54a09e1e61548c93e26f6 Mon Sep 17 00:00:00 2001 From: Charly Gomez Date: Wed, 11 Feb 2026 10:15:42 +0100 Subject: [PATCH 1/2] add headers docs --- docs/platforms/javascript/guides/nextjs/manual-setup/index.mdx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/platforms/javascript/guides/nextjs/manual-setup/index.mdx b/docs/platforms/javascript/guides/nextjs/manual-setup/index.mdx index 9f98884bade4c..86590aeeec884 100644 --- a/docs/platforms/javascript/guides/nextjs/manual-setup/index.mdx +++ b/docs/platforms/javascript/guides/nextjs/manual-setup/index.mdx @@ -286,11 +286,14 @@ Wrap your Server Actions with `Sentry.withServerActionInstrumentation()`. ```typescript {filename:app/actions.ts} "use server"; import * as Sentry from "@sentry/nextjs"; +import { headers } from "next/headers"; export async function submitForm(formData: FormData) { return Sentry.withServerActionInstrumentation( "submitForm", // Action name for Sentry { + headers: await headers(), // Connect client and server traces + formData, // Attach form data to events recordResponse: true, // Include response data }, async () => { From 6bbd9747089e1c1ad9fcd7c53b59edc763f8fb43 Mon Sep 17 00:00:00 2001 From: Charly Gomez Date: Wed, 11 Feb 2026 13:14:39 +0100 Subject: [PATCH 2/2] update why manual --- .../javascript/guides/nextjs/tracing/index.mdx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/platforms/javascript/guides/nextjs/tracing/index.mdx b/docs/platforms/javascript/guides/nextjs/tracing/index.mdx index 0d7651fbc19dc..4933eb3d44463 100644 --- a/docs/platforms/javascript/guides/nextjs/tracing/index.mdx +++ b/docs/platforms/javascript/guides/nextjs/tracing/index.mdx @@ -118,7 +118,8 @@ Server Actions are **not** automatically instrumented. Without wrapping, they ap Use `withServerActionInstrumentation` to: - Create named spans for each action - Capture timing and errors -- Connect client and server traces +- Connect client and server traces via `headers` +- Attach form data to Sentry events via `formData` @@ -148,9 +149,9 @@ export async function createOrder(formData: FormData) { -### With Headers +### With Headers and Form Data -Pass headers to connect client-side traces with server-side spans. This enables full distributed tracing across the browser-to-server boundary. +Pass `headers` to connect client-side traces with server-side spans for full distributed tracing across the browser-to-server boundary. Pass `formData` to attach submitted form data to Sentry events for easier debugging. @@ -164,7 +165,11 @@ import { headers } from "next/headers"; export async function submitForm(formData: FormData) { return Sentry.withServerActionInstrumentation( "submitForm", - { headers: await headers() }, + { + headers: await headers(), // Connect client and server traces + formData, // Attach form data to events + recordResponse: true, // Include response data + }, async () => { // Action logic with full trace context }