* Updated packages Updated all packages to the latest versions * Refactor Sentry monitoring configuration and services The Sentry monitoring configuration and services have been refactored to simplify the setup process. In addition, unnecessary files or exports have been removed from the Sentry package. These changes should make the process of initializing and using the Sentry monitoring services in both the client and server more straightforward and efficient. * Refactor server-side Sentry instrumentation code The conditional logic responsible for checking the runtime environment and the enabled status of the monitoring instrumentation has been adjusted. This refactoring simplifies the code, making it more readable, by clearly separating the conditions and nesting the environment-specific operations. A typo in the environment variable name "ENABLE_MONITORING_INSTRMENTATION" was also corrected to "ENABLE_MONITORING_INSTRUMENTATION". * Rename environment variable for monitoring instrumentation The environment variable controlling monitoring instrumentation has been renamed from 'MONITORING_INSTRUMENTATION_ENABLED' to 'ENABLE_MONITORING_INSTRUMENTATION'. It affects both the README and .env.production files within the monitoring/api and apps/web directories respectively.
28 lines
700 B
TypeScript
28 lines
700 B
TypeScript
import * as Sentry from '@sentry/nextjs';
|
|
|
|
type Parameters<T extends (args: never) => unknown> = T extends (
|
|
...args: infer P
|
|
) => unknown
|
|
? P
|
|
: never;
|
|
|
|
/**
|
|
* @name initializeSentryServerClient
|
|
* @description Initialize the Sentry client in the server
|
|
* @param props
|
|
*/
|
|
export function initializeSentryServerClient(
|
|
props: Parameters<typeof Sentry.init>[0] = {},
|
|
) {
|
|
return Sentry.init({
|
|
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
|
|
|
|
// ...
|
|
|
|
// Note: if you want to override the automatic release value, do not set a
|
|
// `release` value here - use the environment variable `SENTRY_RELEASE`, so
|
|
// that it will also get attached to your source maps,
|
|
...props,
|
|
});
|
|
}
|