使用@ sentry/webpack-plugin和heroku的哨兵 [英] Sentry with @sentry/webpack-plugin and heroku

查看:477
本文介绍了使用@ sentry/webpack-plugin和heroku的哨兵的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm using webpack to build my app and it works locally with @sentry/webpack-plugin – it autogenerates the release and uploads the sourcemaps to Sentry.

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

However, if I'm trying to build the same app on Heroku it gives me the following error:

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)

我在做什么错了?

推荐答案

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

You can fix this by manually specifying the release name in the plugin config:

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

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

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

We use a module called release-it to build a VERSION file when we run npm run release. Here's the .release-it.json config file we use for that:

{
  "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}"
  }
}

这篇关于使用@ sentry/webpack-plugin和heroku的哨兵的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆