使用@ sentry / webpack-plugin和heroku的哨兵

时间:2019-04-16 14:36:12

标签: heroku webpack sentry

我正在使用webpack来构建我的应用程序,并且它在@sentry/webpack-plugin上本地工作–它会自动生成版本并将源地图上传到Sentry。

但是,如果我尝试在Heroku上构建相同的应用程序,则会出现以下错误:

Error: Command failed: /tmp/build_e3ae44a78c063d6493d3fdfc983bd8d6/client/node_modules/@sentry/cli/sentry-cli releases propose-version
  INFO    2019-04-16 13:33:13.141611957 +00:00 Loaded config from /tmp/build_e3ae44a78c063d6493d3fdfc983bd8d6/client/.sentryclirc
  DEBUG   2019-04-16 13:33:13.141666891 +00:00 sentry-cli version: 1.41.0, platform: "linux", architecture: "x86_64"
  INFO    2019-04-16 13:33:13.141684793 +00:00 sentry-cli was invoked with the following command line: "/tmp/build_e3ae44a78c063d6493d3fdfc983bd8d6/client/node_modules/@sentry/cli/sentry-cli" "releases" "propose-version"
  DEBUG   2019-04-16 13:33:13.141916192 +00:00 error: running update nagger
  DEBUG   2019-04-16 13:33:13.141939514 +00:00 skipping update nagger because session is not attended
error: Could not automatically determine release name
  DEBUG   2019-04-16 13:33:13.142576118 +00:00 client close; no transport to shut down  (from sentry)
    at ChildProcess.exithandler (child_process.js:289:12)
    at ChildProcess.emit (events.js:182:13)
    at maybeClose (internal/child_process.js:962:16)
    at Socket.stream.socket.on (internal/child_process.js:381:11)
    at Socket.emit (events.js:182:13)
    at Pipe._handle.close (net.js:606:12)

我在做什么错了?

2 个答案:

答案 0 :(得分:1)

您可以通过在插件配置中手动指定发行版名称来解决此问题:

const version = require('../VERSION').version;

webpackConfig.plugins.push(new SentryWebpackPlugin({
  include: '../src',
  ignoreFile: '.sentrycliignore',
  ignore: ['node_modules', 'webpack.config.js'],
  configFile: '.sentryclirc',
  release: version
}));

运行npm run release时,我们使用名为release-it的模块来构建VERSION文件。这是我们用于此的.release-it.json配置文件:

{
  "non-interactive": true,
  "npm": {
    "publish": false
  },
  "use": "git.tag",
  "pkgFiles": null,
  "scripts": {
    "afterBump": "echo module.exports = {version: \"'\"${version}\"'\"} > $(git rev-parse --show-toplevel)/VERSION"
  },
  "git": {
    "commitMessage": "release: v${version}",
    "requireCleanWorkingDir": false,
    "tagName": "v${version}"
  }
}

答案 1 :(得分:0)

当我建立缓慢的Internet连接时,我遇到了同样的问题。 另外,请检查您使用的API令牌是否在https://sentry.io/settings/account/api/auth-tokens/

中具有写入权限