Skip to content

Integrate Sentry.io for Error Tracking #18

@bhouston

Description

@bhouston

Integrate Sentry.io for Error Tracking

Description

We need to integrate Sentry.io with our Docusaurus site to track and monitor errors that occur in the production environment. This will help us identify and fix issues more quickly.

Implementation Tasks

  • Install the docusaurus-plugin-sentry package
  • Configure Sentry in docusaurus.config.ts with a DSN from Sentry.io
  • Ensure error tracking only runs in production environments
  • Test that errors are properly captured and reported to Sentry

Implementation Details

The integration can be done using the official docusaurus-plugin-sentry plugin:

  1. Installation:
npm install docusaurus-plugin-sentry@latest
# or
yarn add docusaurus-plugin-sentry@latest
# or
pnpm add docusaurus-plugin-sentry@latest
  1. Configuration in docusaurus.config.ts:
plugins: [
  [
    'docusaurus-plugin-sentry',
    {
      DSN: 'YOUR_SENTRY_DSN', // To be replaced with our actual Sentry DSN
      allEnvironments: false, // Only enable in production by default
      configuration: {
        script: {
          defer: true,
        },
        sentry: {
          init: {
            // Additional Sentry initialization options if needed
          }
        }
      }
    },
  ],
],

Prerequisites

  • A Sentry.io account
  • A Sentry project created to obtain a DSN

Additional Considerations

  • Consider configuring source maps uploading for better error context
  • Set up proper release tracking to associate errors with specific deployments

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions