Sentry Plugin
This plugin allows you to integrate Sentry seamlessly with your Payload application.
What is Sentry?
Sentry is a powerful error tracking and performance monitoring tool that helps developers identify, diagnose, and resolve issues in their applications.
This multi-faceted software offers a range of features that will help you manage errors with greater ease and ultimately ensure your application is running smoothly:
Core Features
- Error Tracking: Instantly captures and logs errors as they occur in your application
- Performance Monitoring: Tracks application performance to identify slowdowns and bottlenecks
- Detailed Reports: Provides comprehensive insights into errors, including stack traces and context
- Alerts and Notifications: Send and customize event-triggered notifications
- Issue Grouping, Filtering and Search: Automatically groups similar errors, and allows filtering and searching issues by custom criteria
- Breadcrumbs: Records user actions and events leading up to an error
- Integrations: Connects with various tools and services for enhanced workflow and issue management
Installation
Install the plugin using any JavaScript package manager like pnpm, npm, or Yarn:
Sentry for Next.js setup
This plugin requires to complete the Sentry + Next.js setup before.
You can use either the automatic setup with the installation wizard:
Or the Manual Setup
Basic Usage
In the plugins
array of your Payload Config, call the plugin and pass in your Sentry DSN as an option.
Options
-
Sentry
: Sentry | requiredThe
Sentry
instance
-
enabled
: boolean | optionalSet to false to disable the plugin. Defaults to
true
. -
context
:(args: ContextArgs) => Partial<ScopeContext> | Promise<Partial<ScopeContext>>
Pass additional contextual data to Sentry
-
captureErrors
: number[] | optionalBy default,
Sentry.errorHandler
will capture only errors with a status code of 500 or higher. To capture additional error codes, pass the values as numbers in an array.
Example
Configure any of these options by passing them to the plugin:
TypeScript
All types can be directly imported: