问题
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.
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)
What am I doing wrong?
回答1:
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
}));
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}"
}
}
回答2:
I had the same issue when I build with a slow internet connection. Also, check if the API token you are using have the write permission in https://sentry.io/settings/account/api/auth-tokens/
来源:https://stackoverflow.com/questions/55710718/sentry-with-sentry-webpack-plugin-and-heroku