Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Nuxt] Cannot set release name used by sentry-vite-plugin #13380

Closed
3 tasks done
Tracked by #9095
darthf1 opened this issue Aug 14, 2024 · 3 comments · Fixed by #13811
Closed
3 tasks done
Tracked by #9095

[Nuxt] Cannot set release name used by sentry-vite-plugin #13380

darthf1 opened this issue Aug 14, 2024 · 3 comments · Fixed by #13811
Assignees
Labels
Package: nuxt Issues related to the Sentry Nuxt SDK

Comments

@darthf1
Copy link

darthf1 commented Aug 14, 2024

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/nuxt

SDK Version

8.26.0

Framework Version

8.26.0

Link to Sentry event

No response

Reproduction Example/SDK Setup

nuxt.config.ts

import { defineNuxtConfig } from 'nuxt/config'

export default defineNuxtConfig({
  modules: [
    '@sentry/nuxt/module',
  ],

  sentry: {
    debug: import.meta.env.DEV || import.meta.env.CI,
    sourceMapsUploadOptions: {
      enabled: import.meta.env.NUXT_PUBLIC_SENTRY_ENABLED === 'true',
      authToken: import.meta.env.NUXT_PUBLIC_SENTRY_AUTH_TOKEN,
      org: import.meta.env.NUXT_PUBLIC_SENTRY_ORG,
      project: import.meta.env.NUXT_PUBLIC_SENTRY_PROJECT,
      telemetry: false,
    },
  },

  sourcemap: import.meta.env.NUXT_PUBLIC_SENTRY_ENABLED === 'true',
})

sentry.client.config.ts

import { init } from '@sentry/nuxt'

init({
  enabled: import.meta.env.NUXT_PUBLIC_SENTRY_ENABLED === 'true',
  debug: import.meta.env.DEV || import.meta.env.CI,
  dsn: import.meta.env.NUXT_PUBLIC_SENTRY_DSN,
  environment: import.meta.env.NUXT_PUBLIC_SENTRY_ENVIRONMENT,
  release: import.meta.env.NUXT_PUBLIC_SENTRY_RELEASE,
  // Set tracesSampleRate to 1.0 to capture 100%
  // of transactions for performance monitoring.
  // We recommend adjusting this value in production
  tracesSampleRate: 0.2,
  // Capture Replay for 10% of all sessions,
  // plus for 100% of sessions with an error
  replaysSessionSampleRate: 0.1,
  replaysOnErrorSampleRate: 1,
})

Steps to Reproduce

During build, sourcemaps are created but there is no release associated with them. Also, there is a warning that no release name is provided. It asks specifically for the key release.name but these cannot be set in the nuxt module options.

Expected Result

A successful build, with sourcemaps associated to a specific release.

Actual Result

#18 223.4 > Uploaded files to Sentry
#18 223.7 > File upload complete (processing pending on server)
#18 223.7 > Organization: [MASKED]
#18 223.7 > Project: [MASKED]
#18 223.7 > Release: undefined
#18 223.7 > Dist: None
#18 223.7 > Upload type: artifact bundle
#18 223.7 
#18 223.7 Source Map Upload Report
#18 223.7   Scripts
#18 223.7     ~/00b0fce5-d98a-45f0-9b02-f9525ea59ccc-123.js (sourcemap at BuzfUGYX.js.map, debug id 00b0fce5-d98a-45f0-9b02-f9525ea59ccc)

--- a lot more

#18 223.8   DEBUG   2024-08-14 12:58:44.356205284 +00:00 skipping update nagger because session is not attended
#18 223.8 [sentry-vite-plugin] Info: Successfully uploaded source maps to Sentry
#18 223.8 ℹ ✓ built in 3m 14s
#18 223.8 ✔ Client built in 193954ms
#18 223.8 /bin/sh: git: not found
#18 223.8 [sentry-vite-plugin] Warning: No release name provided. Will not inject release. Please set the release.name option to identify your release.
#18 223.8 [sentry-vite-plugin] Warning: No release name provided. Will not create release. Please set the release.name option to identify your release.
#18 223.8 ℹ Building server...
#18 223.8 ℹ vite v5.4.0 building SSR bundle for production...
@github-actions github-actions bot added the Package: nuxt Issues related to the Sentry Nuxt SDK label Aug 14, 2024
@s1gr1d
Copy link
Member

s1gr1d commented Aug 14, 2024

The release option has not been added yet, but we will add this asap!

@s1gr1d
Copy link
Member

s1gr1d commented Sep 26, 2024

Sorry for the late reply on this. The Nuxt SDK comes with the Sentry Vite plugin and this plugin detects the release name itself (e.g. from git or other environment variables). You can see how the plugin looks for the release name here in the code. You can get this warning if you don't have a git repository set up.

If you want to provide a custom release name you can do this like this (after #13811 is released):

export default defineNuxtConfig({
  modules: ["@sentry/nuxt/module"],
  sentry: {
      sourceMapsUploadOptions: {
        org: 'my-org',
        project: 'my-project',
      },
      debug: true,
      unstable_sentryBundlerPluginOptions: {
        release: {
          name: 'custom-release-name',
        },
      },
  },
});

Copy link
Contributor

github-actions bot commented Oct 2, 2024

A PR closing this issue has just been released 🚀

This issue was referenced by PR #13811, which was included in the 8.33.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: nuxt Issues related to the Sentry Nuxt SDK
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants