DEV Community

Strapi
Strapi

Posted on • Originally published at strapi.io

Introducing the official Sentry plugin for Strapi

Back in October, we ran a survey across the Strapi community. Your feedback was clear: plugins are essential to your workflow. They give you the option to expand Strapi's core capabilities as you see fit. They allow you to connect your favorite tools to your CMS, and build better, more ambitious apps with Strapi.

We also share that vision. Our plan for Strapi is to have an open marketplace showcasing quality plugins. That's why in 2021, we'll be focusing on building an ecosystem of plugins, by working with both partners and you, the community. Today, we're starting that journey with a highly requested plugin: Sentry 🎉

What's Sentry, and why you should care

Sentry allows developers to ensure the quality of their applications. It logs errors and gives you all the context you need to identify the source of the problem. Thanks to Sentry, You can identify the previous events that led to an error, and what commit introduced the bug. And once you can reproduce an issue, fixing it becomes much simpler.

This plugin lets you benefit from all these Sentry features within your Strapi app. Once you install it, the Sentry plugin will:

  • Initialize a Sentry instance when your Strapi app starts
  • Send errors encountered in your application's end API to Sentry
  • Attach useful metadata to Sentry events, to help you with debugging
  • Expose a global Sentry service

How to use it

Sentry has always been a solution of choice among our users. Our users have been manually setting it up in their apps for years. But from now on, using it in Strapi is as easy as installing the package:

# Using Yarn
yarn add strapi-plugin-sentry

# Or using NPM
npm install strapi-plugin-sentry
Enter fullscreen mode Exit fullscreen mode

Then, you'll need to link Strapi to your Sentry project. Find your data source name (DSN) on your Sentry app.

Then, enter that DSN in your app's config/plugins.js file.

module.exports = ({ env }) => ({
  // ...
  sentry: {
    dsn: env('SENTRY_DSN'),
  },
  // ...
});
Enter fullscreen mode Exit fullscreen mode

That's it, restart your app and you're good to go. All your errors will now be logged on Sentry!

Now, let’s take a look at how we can use this plugin in a real-world application.

Find the plugin on GitHub

We want to make Strapi the most customizable and open CMS. That’s why you can find this plugin’s source code on GitHub. There, you’ll find all the documentation you need to adapt or extend the plugin to suit your needs.

You can give us your feedback using GitHub issues, or by reaching out on Twitter. And your contributions are always welcome, so don’t hesitate to submit a pull request. We’ll be happy to review it!

Join the live plugin demo

To find out more about this plugin, you can sign up for our next webinar: JAMstack Monitoring with Strapi and Sentry. It will be on the 25th of February and co-hosted by Rohit Kataria, customer solutions engineer at Sentry. Together, we will walk you through the best practices for an end to end JAMstack Monitoring.

In the meantime, happy debugging!

Top comments (0)