ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • 센트리 로컬 환경에서 사용할 수 있게 설정하기
    기록이라도 하자 2023. 8. 2. 22:15

    • 보통은 필요 없지만 간혹 로컬에서 상용 배포를 수동으로 한다든가, 빌드시 센트리를 위해 소스맵까지 빌드하는 것을 확인하고 싶다면 로컬에서 센트리 설정 파일(.sentryclirc)가 있어야 한다.
    • 요즘 소스맵이 너무 커져서 빌드하다가 메모리가 부족해 죽는 현상으로 인해 로컬 테스트가 필요해졌다.
    • 개발 환경이 바뀌면서 어떤 컴퓨터에는 설정되어 있고 어떤 컴퓨터에는 설정되어 있지 않았는데, 이 정보 찾기가 귀찮아서 계속 미루다가 나중의 나를 위해 설정하면서 기록한다.

     

    설정 하는 법

    1. sentry-cli 설치
    npm install -g @sentry/cli
    curl -sL https://sentry.io/get-cli/ | sh

    다양한 방법으로 설치할 수 있지만 난 npm으로 설치했다. (둘 중 아무거나 하면 됨)
    다른 설치 방법은 https://docs.sentry.io/product/cli/installation/ 에서 확인하면 된다.

     

    2. sentry 웹 페이지 진입 후 로그인

    아래 3번의 명령어를 입력하면 웹페이지로 이동하는데, 그렇게 이동했을 때 잘못된 페이지로 진입이 되어서 미리 로그인 해두면 좋을 것 같다.

     

    3. terminal에서 cli 로그인 -> .sentryclirc 파일 생성

    https://docs.sentry.io/product/cli/configuration/ 참고

    • 첫번째 명령어를 입력한다.
    sentry-cli login
    • 위 명령어를 입력하고 나면 뭐라고 막 뜨는데 'y'를 입력하면 브라우저 창이 열린다.
    sentry-cli login
    This helps you signing in your sentry-cli with an authentication token.
    If you do not yet have a token ready we can bring up a browser for you
    to create a token now.
    Sentry server: sentry.io
    
    Open browser now? [y/n] y
    • 아래 이미지와 같은 화면이 표시될텐데, 아래 Auth Token 영역의 토큰을 복사(빨간색 부분 클릭시 복사됨)해서 다시 터미널에 붙여넣기 한다. 

    sentry-cli login
    This helps you signing in your sentry-cli with an authentication token.
    If you do not yet have a token ready we can bring up a browser for you
    to create a token now.
    Sentry server: sentry.io
    Open browser now? [y/n] y
    
    Enter your token: {여기에 복사한 토큰 붙여넣기}
    •  붙여 넣으면 토큰이 저장된 파일이 생겼다는 메세지가 표시된다
    sentry-cli login
    This helps you signing in your sentry-cli with an authentication token.
    If you do not yet have a token ready we can bring up a browser for you
    to create a token now.
    Sentry server: sentry.io
    Open browser now? [y/n] y
    Enter your token: {여기에 복사한 토큰 붙여넣기}
    
    Valid token for user {내 이메일 주소}
    Stored token in {파일 경로}\.sentryclirc


    그리고 다시 빌드를 해보면 에러가 하나도 안 없어졌다ㅋㅋㅋ

    ERROR in Sentry CLI Plugin: Command failed: {경로}\node_modules\@sentry\cli\sentry-cli.exe releases new local
    error: An organization slug is required (provide with --org)
    
    Add --log-level=[info|debug] or export SENTRY_LOG_LEVEL=[info|debug] to see more output.
    Please attach the full debug log to all bug reports.


    4. 생성된 .sentryclirc 파일을 열어 project와 org 설정을 한다

    - 아까 생성된 파일 경로에서 해당 파일을 찾아서 열어 project 이름과 org 이름까지 설정한다.

    - org 이름과 project 이름은 sentry website Settings에서 찾을 수 있다

    [auth]
    token={토큰}
    
    [defaults]
    project={project 이름}
    org={org 이름}

    - org는 organization slug에 있는 값(노란색 표시)을, project는 projects나 settings - projects에 있는 프로젝트 명을 확인하고 파일에 저장하면 된다.

     

    자세한 내용은 여기서 확인 : https://docs.sentry.io/product/cli/configuration/ 

     

    Configuration and Authentication

    Learn about the functionality of Sentry's command line interface and how you can install, configure, authenticate, set up release management, debug information files, and send events.

    docs.sentry.io


    설정 다했다! 

Designed by Tistory.