Marc Roig 17dbeb2030
release: main to develop (#21963)
* fix: make contrib docs landing message clearer to users

* v5.1.1 to main (#21954)

* enhancement: ui issues and french translations (#21633)

* chore: ui issues and french translations

* chore: added missing translation

* chore: made it prettier

* fix: test CI/CD building repo 2 times (#21740)

* fix: do not display fill from locales if i18n no enabled (#21737)

* fix: do not display fill from locales if i18n no enabled

* chore: disable only if there is not i18n enabled

* fix: send ids when connecting relations to update u&p user role (#21726)

* fix:update role

* fix: send entry id when connecting/disconnecting relations

* fix: changed empty components wording (#21630)

* fix: changed empty components wording

* fix: updated selectors

* fix: made it prettier

* enhancement: add preview panel button (#21776)

* chore: add test workflow filters for each test type (#21770)

* chore: upgrade mysql2 package to 3.9.8 (#21795)

* feat: add mapping property support for documentation plugin's open api generated docs (#21752)

* feat: add mapping property support for documentation plugin's open API generated spec

Dynamic zones are reflected in the OpenAPI docs generated as an anyOf.
We can use a discriminator and mapping to improve the docs.

* fix: missing one value enum for __component property

* enhancement: extract logic to convert component names to OpenAPI names

* chore: run prettier write on clean schema attributes

---------

Co-authored-by: Jamie Howard <48524071+jhoward1994@users.noreply.github.com>

* chore: fix mysql workflow (#21801)

* chore: upgrade koa/router to 12.0.2 (#21802)

* Update "upgrade major" rules (#21745)

* fix: broken list view pagination (#21800)

* fix: broken list view pagination

* chore: add list view pagination e2e test

* enhancement: add copy preview url button (#21780)

* enhancement: add copy preview button

* chore: remove useClipboard from upload plugin

* Add <latest> Upgrade Command (#21754)

* Make locale/localizations private for non-localized cts (#21495)

* chore: upgrade sendgrid-mail to 8.1.3 (#21797)

* chore: re-enable history e2e tests (#21739)

* fix: reenable history api tests

fix: flaky findAndClose

fix: close notifications

* chore: add test workflow filters for each test type

* chore: fix node versions

* fix: match format of test.yml

* revert: don't add test_result to skipped_tests

* fix: add new outputs vars

---------

Co-authored-by: Ben Irvin <ben@innerdvations.com>

* fix: search by numeric numbers in a relation (#21873)

* Sort Generated Content-Types and Components Definitions (#21868)

* fix(e2e): remove webkit skip conditions (#21611)

* fix(e2e): remove webkit skip conditions

* chore: revert uniqueness spec to test others on ci

* fix(e2e): ctb navigation

* chore: ci config to speed up testing

* chore: revert lock

* chore(e2e): wip add webkit waiting

* chore: single out history spec changes for ci

* chore(e2e): use new webkit navigation for all affected test files

* chore(e2e): revert e2e ci config so all tests run again

* chore(e2e): temp skip uniqueness to test others

* chore(e2e): revert so all tests run again

* chore(e2e): re-skip uniqueness in webkit

* chore(e2e): revert workflow yaml

* chore(e2e): pr feedback

---------

Co-authored-by: Ben Irvin <ben.irvin@strapi.io>

* fix(strapi/types): add Attribute column type (#21858)

* chore: add preview tracking (#21913)

* chore: upgrade plop to 4.0.1 (#21798)

* chore: upgrade cookie to 0.7.1 (#21833)

* enhancement: DTS assert count of items sent and received is equal (#21900)

* feat: added a count, start, finish counts to compare data recieved with data sent

* feat: refactoring

* feat: refactoring

* v5.1.1

---------

Co-authored-by: Lucas Boilly <45385696+lucasboilly@users.noreply.github.com>
Co-authored-by: Boegie19 <34578426+Boegie19@users.noreply.github.com>
Co-authored-by: Rémi de Juvigny <8087692+remidej@users.noreply.github.com>
Co-authored-by: Ben Irvin <ben.irvin@strapi.io>
Co-authored-by: Pedro Cerejo <pedro.cerejo@tecnico.ulisboa.pt>
Co-authored-by: Jamie Howard <48524071+jhoward1994@users.noreply.github.com>
Co-authored-by: Jean-Sébastien Herbaux <jean-sebastien.herbaux@epitech.eu>
Co-authored-by: Rémi de Juvigny <remi.dejuvigny@strapi.io>
Co-authored-by: Ben Irvin <ben@innerdvations.com>
Co-authored-by: Andrei Luca <1881266+iamandrewluca@users.noreply.github.com>
Co-authored-by: Bassel Kanso <basselkanso82@gmail.com>

* fix: prettier

---------

Co-authored-by: Pierre Wizla <pwizla@users.noreply.github.com>
Co-authored-by: Alexandre BODIN <alexandrebodin@users.noreply.github.com>
Co-authored-by: Lucas Boilly <45385696+lucasboilly@users.noreply.github.com>
Co-authored-by: Boegie19 <34578426+Boegie19@users.noreply.github.com>
Co-authored-by: Rémi de Juvigny <8087692+remidej@users.noreply.github.com>
Co-authored-by: Ben Irvin <ben.irvin@strapi.io>
Co-authored-by: Pedro Cerejo <pedro.cerejo@tecnico.ulisboa.pt>
Co-authored-by: Jamie Howard <48524071+jhoward1994@users.noreply.github.com>
Co-authored-by: Jean-Sébastien Herbaux <jean-sebastien.herbaux@epitech.eu>
Co-authored-by: Rémi de Juvigny <remi.dejuvigny@strapi.io>
Co-authored-by: Ben Irvin <ben@innerdvations.com>
Co-authored-by: Andrei Luca <1881266+iamandrewluca@users.noreply.github.com>
Co-authored-by: Bassel Kanso <basselkanso82@gmail.com>
2024-10-24 14:16:34 +02:00
..
2024-10-24 14:16:34 +02:00
2023-01-04 17:16:16 +01:00

Strapi plugin Sentry

The official plugin to track Strapi errors with Sentry.

Features

  • 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

Installation

To install this plugin, you need to add an NPM dependency to your Strapi application.

# Using Yarn
yarn add @strapi/plugin-sentry

# Or using NPM
npm install @strapi/plugin-sentry

Configuration

property type (default) description
dsn string (null) Your Sentry data source name (see Sentry docs).
sendMetadata boolean (true) Whether the plugin should attach additional information (like OS, browser, etc.) to the events sent to Sentry.
init object ({}) A config object that is passed directly to Sentry during the Sentry.init(). See all available options on Sentry's docs

Example

./config/plugins.js

module.exports = ({ env }) => ({
  // ...
  sentry: {
    enabled: true,
    config: {
      dsn: env('SENTRY_DSN'),
      sendMetadata: true,
    },
  },
  // ...
});

Global Sentry service

You can access a Sentry service throughout your app.

const sentryService = strapi.plugin('sentry').service('sentry');

This service exposes the following methods:

sendError(error, configureScope)

Use it to manually send errors to Sentry. The configureScope is optional, it allows you to customize the error event. Read more about Sentry's scope system on their docs.

Example

try {
  // Your code here
} catch (error) {
  // Either send a simple error
  strapi.plugin('sentry').service('sentry').sendError(error);

  // Or send an error with a customized Sentry scope
  strapi
    .plugin('sentry')
    .service('sentry')
    .sendError(error, (scope, sentryInstance) => {
      // Customize the scope here
      scope.setTag('my_custom_tag', 'Tag value');
    });
  throw error;
}

getInstance()

Use it if you need direct access to the Sentry instance, which should already already be initialized. It's useful if sendError doesn't suit your needs.

Example

const sentryInstance = strapi.plugin('sentry').service('sentry').getInstance();

Disabling for non-production environments

If the dsn property is set to a nil value (null or undefined) while enabled is true, the Sentry plugin will be available to use in the running Strapi instance, but the service will not actually send errors to Sentry. That allows you to write code that runs on every environment without additional checks, but only send errors to Sentry in production.

When you start Strapi with a nil dsn config property, the plugin will print a warning:
info: @strapi/plugin-sentry is disabled because no Sentry DSN was provided

You can make use of that by using the env utility to set the dsn config property depending on the environment.

Example

./config/plugins.js

module.exports = ({ env }) => ({
  // ...
  sentry: {
    enabled: true,
    config: {
      // Only set `dsn` property in production
      dsn: env('NODE_ENV') === 'production' ? env('SENTRY_DSN') : null,
    },
  },
  // ...
});

Disabling altogether

Like every other plugin, you can also disable this plugin in the plugins configuration file. This will cause strapi.plugins('sentry') to return undefined.

Example

./config/plugins.js

module.exports = ({ env }) => ({
  // ...
  sentry: {
    enabled: false,
  },
  // ...
});