You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在自建Sentry中使用sentry-cli sourcemaps explain命令?

问题

我执行以下命令:

sentry-cli sourcemaps explain $EVENT --org $ORG --project $PROJECT_NAME

返回错误:

error: API request failed
  caused by: sentry reported an error: Invalid token (http status: 401)

确认.sentryclirc中的token正确,添加--log-level=debug后发现sentry-cli默认请求sentry.io,不符合自建Sentry配置。尝试添加--url $URL参数,命令改为:

sentry-cli sourcemaps explain $EVENT --url $URL --org $ORG --project $PROJECT_NAME

又返回错误:

error: Found argument '--url' which wasn't expected, or isn't valid in this context

        If you tried to supply `--url` as a value rather than a flag, use `-- --url`

请问如何在自建Sentry中使用该命令?

解决方法

针对自建Sentry实例使用sentry-cli sourcemaps explain命令,有以下几种可行方案:

  • 使用正确的命令行参数:sentry-cli中指定自建Sentry地址的参数不是--url,而是--api-url。修正后的命令为:

    sentry-cli sourcemaps explain $EVENT --api-url $URL --org $ORG --project $PROJECT_NAME
    
  • 通过配置文件指定:在.sentryclirc文件中添加url配置项,避免每次命令都传参数。配置示例:

    [auth]
    token=你的有效token
    
    [defaults]
    url=https://你的自建Sentry地址/
    org=你的组织名
    project=你的项目名
    

    配置完成后,直接执行原命令即可:

    sentry-cli sourcemaps explain $EVENT
    
  • 通过环境变量设置:设置SENTRY_URL环境变量,命令执行时会自动读取该值:

    export SENTRY_URL=https://你的自建Sentry地址/
    sentry-cli sourcemaps explain $EVENT --org $ORG --project $PROJECT_NAME
    

内容的提问来源于stack exchange,提问作者Vladimír

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.08 08:08:30