question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sentry CLI: Unable to determine version

See original GitHub issue

Hello, I am deploying a Nuxt.js / Vue app on Zeit Now/Vercel and have setup my webpack config as follows:

...

const release = process.env.COMMIT_SHA || process.env.NOW_BITBUCKET_COMMIT_SHA || process.env.BUILD_STAGE;
// eslint-disable-next-line no-console
console.log('🚀 releasing', release);

if (process.env.SENTRY_PUBLISH_SOURCEMAPS === 'true') {
  config.build.plugins.push(new SentryWebpackPlugin({
    debug: true,
    release,
    include: '.',
    ignoreFile: '.sentrycliignore',
    ignore: [
      'node_modules',
      'node_modules_dev',
      'node_modules_prod',
      'tests',
      '*.config.js',
      '.eslintrc.js',
    ],
  }));
}

I have confirmed via the console.log command that “release” is being set to a valid commit sha, however in the build I still see this error.

ERROR in Sentry CLI Plugin: Unable to determine version. Make sure to include release option or use the environment that supports auto-detection https://docs.sentry.io/cli/releases/#creating-releases

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
churichardcommented, May 10, 2020

I’m using Next.js and was running into this issue when following the with-sentry-simple example. Adding release: options.buildId to the SentryWebpackPlugin options like @vitalbone has in his code snippet fixed this issue for me.

2reactions
goranefblcommented, May 6, 2020

had the same issue, used options.buildId for the release version. next.js config file:

const withSass = require('@zeit/next-sass');
const withCSS = require('@zeit/next-css');
const withVideos = require('next-videos');
const withPlugins = require('next-compose-plugins');
const withSourceMaps = require('@zeit/next-source-maps')();
const SentryWebpackPlugin = require('@sentry/webpack-plugin');

module.exports = withPlugins(
	[
		[
			withSass,
			{
				cssModules: true,
				cssLoaderOptions: {
					importLoaders: 1,
					localIdentName: '[name]__[local]___[hash:base64:5]'
				}
			}
		],
		[withCSS, {}],
		[withVideos, {}],
		[withSourceMaps]
	],
	{
		webpack(config, options) {
			config.module.rules.push({
				test: /\.(woff|woff2|eot|ttf|otf)$/,
				use: [
					{
						loader: 'url-loader',
						options: {
							limit: 8192,
							fallback: 'file-loader',
							publicPath: `/_next/static/chunks/fonts/`,
							outputPath: `${options.isServer ? '../' : ''}static/chunks/fonts/`,
							name: '[name]-[hash].[ext]'
						}
					}
				]
			});
			config.module.rules.push({
				test: /\.(jpe?g|png|svg|gif|ico|webp)$/,
				use: [
					{
						loader: 'url-loader',
						options: {
							limit: 8192,
							fallback: 'file-loader',
							publicPath: `/_next/static/images/`,
							outputPath: `${options.isServer ? '../' : ''}static/images/`,
							name: '[name]-[hash].[ext]'
						}
					}
				]
			});

			config.module.rules.push({
				test: /\.(mp3)$/,
				use: [
					{
						loader: 'url-loader',
						options: {
							limit: 8192,
							fallback: 'file-loader',
							publicPath: `/_next/static/sound/`,
							outputPath: `${options.isServer ? '../' : ''}static/sound/`,
							name: '[name]-[hash].[ext]'
						}
					}
				]
			});
			config.module.rules.push({
				test: /\.scss$/,
				use: [
					{
						loader: 'sass-loader',
						options: {
							prependData: '@import "./static/scss/globals.scss";',
							sourceMap: true
						}
					}
				]
			});
			// Ask Webpack to replace @sentry/node imports with @sentry/browser when
			// building the browser's bundle
			if (!options.isServer) {
				// eslint-disable-next-line no-param-reassign
				config.resolve.alias['@sentry/node'] = '@sentry/browser';
			}
			// The Sentry webpack plugin gets pushed to the webpack plugins to build
			// and upload the source maps to sentry.
			config.plugins.push(
				new SentryWebpackPlugin({
					include: '.next',
					configFile: 'sentry.properties',
					release: options.buildId,
					ignore: ['node_modules'],
					urlPrefix: '~/_next'
				})
			);

			return config;
		},
		publicRuntimeConfig: {
			APP_ENV: process.env.APP_ENV
		}
	}
);

Read more comments on GitHub >

github_iconTop Results From Across the Web

Release Management - Sentry Documentation
Releases are created with the sentry-cli releases new command. It takes at the very least a version identifier that uniquely identifies the releases....
Read more >
Sentry with @sentry/webpack-plugin and heroku
You can fix this by manually specifying the release name in the plugin config: const version = require('../VERSION').version ...
Read more >
@sentry/cli - npm
A command line utility to work with Sentry. https://docs.sentry.io/hosted/learn/cli/. Latest version: 2.11.0, last published: 9 days ago.
Read more >
sentry-cli-binary - npm Package Health Analysis - Snyk
Learn more about sentry-cli-binary: package health score, popularity, security, maintenance, versions and more.
Read more >
@sentry/cli | Yarn - Package Manager
Important: This documentation covers modern versions of Yarn. For 1.x docs, see classic.yarnpkg.com. Yarn.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found