yarn @sentry/react 7.81.0

latest releases: 8.37.1, 8.37.0, 8.36.0...
11 months ago

Important Changes

- feat(nextjs): Add instrumentation utility for server actions (#9553)

This release adds a utility function withServerActionInstrumentation to the @sentry/nextjs SDK for instrumenting your Next.js server actions with error and performance monitoring.

You can optionally pass form data and headers to record them, and configure the wrapper to record the Server Action responses:

import * as Sentry from "@sentry/nextjs";
import { headers } from "next/headers";

export default function ServerComponent() {
  async function myServerAction(formData: FormData) {
    "use server";
    return await Sentry.withServerActionInstrumentation(
      "myServerAction", // The name you want to associate this Server Action with in Sentry
      {
        formData, // Optionally pass in the form data
        headers: headers(), // Optionally pass in headers
        recordResponse: true, // Optionally record the server action response
      },
      async () => {
        // ... Your Server Action code

        return { name: "John Doe" };
      }
    );
  }

  return (
    <form action={myServerAction}>
      <input type="text" name="some-input-value" />
      <button type="submit">Run Action</button>
    </form>
  );
}

Other Changes

  • docs(feedback): Example docs on sendFeedback (#9560)
  • feat(feedback): Add level and remove breadcrumbs from feedback event (#9533)
  • feat(vercel-edge): Add fetch instrumentation (#9504)
  • feat(vue): Support Vue 3 lifecycle hooks in mixin options (#9578)
  • fix(nextjs): Download CLI binary if it can't be found (#9584)
  • ref: Deprecate extractTraceParentData from @sentry/core & downstream packages (#9158)
  • ref(replay): Add further logging to network body parsing (#9566)

Work in this release contributed by @snoozbuster. Thank you for your contribution!

Bundle size 📦

Path Size
@sentry/browser (incl. Tracing, Replay) - Webpack (gzipped) 65.53 KB
@sentry/browser (incl. Tracing, Replay) - Webpack with treeshaking flags (gzipped) 55.67 KB
@sentry/browser (incl. Tracing) - Webpack (gzipped) 31.01 KB
@sentry/browser - Webpack (gzipped) 21.32 KB
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (gzipped) 61.99 KB
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (gzipped) 29.13 KB
@sentry/browser - ES6 CDN Bundle (gzipped) 21.26 KB
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (minified & uncompressed) 195.53 KB
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (minified & uncompressed) 88.38 KB
@sentry/browser - ES6 CDN Bundle (minified & uncompressed) 63.34 KB
@sentry/browser (incl. Tracing) - ES5 CDN Bundle (gzipped) 31.85 KB
@sentry/react (incl. Tracing, Replay) - Webpack (gzipped) 65.84 KB
@sentry/react - Webpack (gzipped) 21.36 KB
@sentry/nextjs Client (incl. Tracing, Replay) - Webpack (gzipped) 82.58 KB
@sentry/nextjs Client - Webpack (gzipped) 48.15 KB
@sentry-internal/feedback - Webpack (gzipped) 16.08 KB

Don't miss a new react release

NewReleases is sending notifications on new releases.