Logging & Error Monitoring (Sentry)

Pasang platform pemantau error seperti Sentry agar kamu menerima notifikasi instan saat user mengalami crash di production.

👀 Contoh dulu

import * as Sentry from '@sentry/nextjs';
// Otomatis menangkap uncaught error di server & client

Hasilnya: Mencatat stacktrace lengkap error produksi ke dashboard Sentry.

💡 Error monitoring memberi tahu bug produksi sebelum dikomplain oleh client.

📝 Sekarang giliranmu

Untuk menangkap error production dengan Sentry secara otomatis di Next.js, kamu perlu membungkus konfigurasi build. Impor library withSentryConfig dari @sentry/nextjs dan jadikan sebagai fungsi pembungkus objek konfigurasi aslimu.

Preview