Next.js 15 Fullstack (App Router + Server Actions) · Lección

Supervisión y seguimiento de errores en producción

Mantenga saludable su app de Next.js desplegada mediante logging estructurado, seguimiento de errores con Sentry, analítica de rendimiento y supervisión de disponibilidad.

Lección 4 de 413 pasos

Supervisión y seguimiento de errores en producción es una lección gratuita de Next.js 15 Fullstack (App Router + Server Actions) en CoddyKit. Esta es la lección 4 de 4. Puedes leer la lección completa abajo gratuitamente — luego la practicas en el navegador con un editor de código integrado y un tutor de IA 24/7. Forma parte de la ruta de aprendizaje de Next.js 15 Fullstack (App Router + Server Actions), y tu progreso se sincroniza en la web y la app de CoddyKit. El curso de Next.js 15 Fullstack (App Router + Server Actions) incluye 4 lecciones en total.

Partes de esta lección aún no han sido traducidas y se muestran en inglés.

Why Monitor Production?

Once your app is live, you cannot reproduce every user's environment. Monitoring tells you when something breaks, how often, and for whom — so you fix issues before they spread.

The Three Pillars

Observability rests on:

  • Logs: discrete events
  • Metrics: numbers over time (latency, error rate)
  • Traces: the path of a request across services

Structured Logging

Plain text logs are hard to search. Emit structured JSON logs with consistent fields so tools can filter and aggregate them.

console.log(JSON.stringify({
  level: 'error',
  route: '/api/checkout',
  userId: 42,
  msg: 'payment failed'
}));

Installing Sentry

Sentry captures unhandled errors with stack traces and context. The wizard wires it into both server and client.

npx @sentry/wizard@latest -i nextjs

Capturing Errors

Sentry catches uncaught exceptions automatically, but you can also report handled errors with extra context.

import * as Sentry from '@sentry/nextjs';
try {
  await charge();
} catch (e) {
  Sentry.captureException(e, { tags: { feature: 'billing' } });
}

Error Boundaries with error.tsx

An error.tsx file catches render errors in a route segment and shows a fallback instead of a white screen. It is a Client Component.

'use client';
export default function Error({ error, reset }) {
  return <button onClick={reset}>Try again</button>;
}

Performance with Web Vitals

Track real user experience with Core Web Vitals — LCP, CLS, INP. Next.js exposes them through a reporting hook.

export function reportWebVitals(metric) {
  if (metric.name === 'LCP') sendToAnalytics(metric);
}

Vercel Analytics & Speed Insights

On Vercel, the Analytics and Speed Insights packages collect real-world metrics with one component each, no extra config.

import { SpeedInsights } from '@vercel/speed-insights/next';
// render <SpeedInsights /> in your root layout

Uptime Monitoring

An uptime monitor pings a health endpoint at intervals and alerts you if it fails. Expose a lightweight route for this.

// app/api/health/route.ts
export function GET() {
  return Response.json({ status: 'ok' });
}

Setting Up Alerts

Data is useless if no one looks. Configure alerts: notify the team on Slack when error rate spikes or latency crosses a threshold. Alert on symptoms users feel, not noise.

Best Practices

Stay on top of production:

  • Emit structured logs
  • Track errors with Sentry and error.tsx
  • Watch Core Web Vitals
  • Add an uptime check and meaningful alerts

Quick Check

Test your monitoring knowledge.

Recap

You learned to monitor production:

  • Logs, metrics, and traces form observability
  • Use structured logging and Sentry for error tracking
  • Catch render errors with error.tsx
  • Track Web Vitals, add a health endpoint, and set alerts

Now you find and fix problems before users complain.

Gratis para empezar

Aprende TypeScript con un tutor de IA — gratis

Escribe y ejecuta código real en tu navegador, obtén ayuda instantánea de un tutor de IA disponible 24/7 y continúa donde lo dejaste en la web o en la aplicación.

Cursos
22
Lecciones
88

Preguntas frecuentes

¿La lección «Supervisión y seguimiento de errores en producción» es gratis?

Sí — el texto completo de «Supervisión y seguimiento de errores en producción» es gratis para leer aquí en la web. Para practicarla de forma interactiva (editor de código integrado y tutor de IA 24/7) y desbloquear el resto del curso de Next.js 15 Fullstack (App Router + Server Actions), actualiza a CoddyKit PRO. El curso de Next.js 15 Fullstack (App Router + Server Actions) incluye 4 lecciones en total.

¿Qué aprenderé en «Supervisión y seguimiento de errores en producción»?

Mantenga saludable su app de Next.js desplegada mediante logging estructurado, seguimiento de errores con Sentry, analítica de rendimiento y supervisión de disponibilidad. Practicas Next.js 15 Fullstack (App Router + Server Actions) con código real que ejecutas directamente en el navegador, y un tutor de IA 24/7 responde tus preguntas mientras trabajas en la lección.

¿Necesito experiencia previa para empezar Next.js 15 Fullstack (App Router + Server Actions)?

No se requiere experiencia previa. Next.js 15 Fullstack (App Router + Server Actions) en CoddyKit está estructurado para principiantes hasta estudiantes avanzados, así que puedes empezar aquí o desde el inicio y avanzar a tu ritmo. Esta es la lección 4 de 4.

¿Cuánto tiempo toma la lección «Supervisión y seguimiento de errores en producción»?

La mayoría de las lecciones de CoddyKit toman alrededor de 5–10 minutos. Cada una es compacta e interactiva, así que avanzas constantemente y retomas exactamente por donde dejaste en la web y la app.

¿Puedo escribir y ejecutar código en esta lección de Next.js 15 Fullstack (App Router + Server Actions)?

Sí. Cada lección de Next.js 15 Fullstack (App Router + Server Actions) incluye un editor de código integrado, así que escribes y ejecutas código real directamente en tu navegador y obtienes retroalimentación instantánea de IA — sin configuración local necesaria.

Todas las lecciones de este curso

  1. Despliegue en Vercel
  2. Construcción de una aplicación full-stack
  3. Revisión del proyecto y prácticas recomendadas
  4. Supervisión y seguimiento de errores en producción
← Volver a Next.js 15 Fullstack (App Router + Server Actions)