LoginSignup
0
0

More than 5 years have passed since last update.

Expo with Sentry設定メモ

Posted at

TL;DR

設定が二箇所で必要で忘れてつまづいたのでメモ
* App.jsにPublic DNS
* app.jsonにorganization, project, authToken

前提

  • dev環境とprod環境をapp.jsonファイルを切り替える構成
  • Sentryのログ送出先は環境ごとにプロジェクトを分ける(expo-sentryライブラリで環境を切り替える方法がわからなかったからです。バッドプラクティスだと思うんで真似しないで...

Code

app.dev.json
{
  "expo": {
    "name": "MyApp",
    ...
    "hooks": {
      "postPublish": [
        {
          "file": "sentry-expo/upload-sourcemaps",
          "config": {
            "organization": "ここにorganization",
            "project": "ここにproject",
            "authToken": "ここにauthToken"
          }
        }
      ]
    },
    ...
    "extra": {
      "sentryPublicDSN": "ここにPublic DSN(形式が二つあるけど、deprecatedじゃない方)"
    }
  }
}
App.js
import { Constants } from 'expo';
...
import Sentry from 'sentry-expo';

Sentry.enableInExpoDevelopment = true;
Sentry.config(Constants.manifest.extra.sentryPublicDSN).install();

デプロイするときには app.dev.jsonapp.jsonに差し替えます。
ln -fs app.dev.json app.json && expo publish

0
0
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
0
0