Introduce error boundary mechanism and exception capture with Baselime and Sentry

Deleted the ErrorBoundary component from the makerkit package and introduced new exception capture mechanisms for Baselime and Sentry monitoring providers. The code now captures all exceptions thrown within components and sends them to the configured monitoring provider, which in turn logs the errors for debugging purposes. Updated packages and environment variables accordingly to support this feature.
This commit is contained in:
giancarlo
2024-04-15 14:14:08 +08:00
parent bb19d6d207
commit 07ff9a7f8e
31 changed files with 327 additions and 131 deletions

View File

@@ -2,11 +2,17 @@
* This file is used to register monitoring instrumentation
* for your Next.js application.
*/
const RUNTIME = process.env.NEXT_RUNTIME;
const ENABLE_INSTRUMENTATION =
process.env.MONITORING_INSTRUMENTATION_ENABLED === 'true';
export async function register() {
// only run in nodejs runtime
if (process.env.NEXT_RUNTIME === 'nodejs') {
if (RUNTIME === 'nodejs' && ENABLE_INSTRUMENTATION) {
const { registerMonitoringInstrumentation } = await import(
'@kit/monitoring'
'@kit/monitoring/instrumentation'
);
// Register monitoring instrumentation based on the