LoginSignup
11
9

More than 5 years have passed since last update.

Sentry でのエラー通知を development 環境では防ぐ方法

Posted at

Sentry の config 内で設定可能。
shouldSendCallback での返り値が false だと、 Sentry はエラーをレポートしない。
以下の例では、配列に 'production', 'staging' など指定し、指定した環境のレポートのみ送信する例。

import Raven from 'raven-js';

Raven.config('https://セントリーのurl', {
      release: RELEASE,
      environment: process.env.NODE_ENV,
      shouldSendCallback: () => {
          return ['production', 'staging'].indexOf(process.env.NODE_ENV) !== -1;
      },
  }).install();

environment の キー をつけておくと、レポート時にタグも付けれる。絞り込みをする際に便利。

environment に production のタグをつけれる
image.png

参考

11
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
9