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]: Wrong issue environment tag #15623

Open
3 tasks done
priscilawebdev opened this issue Mar 10, 2025 · 3 comments
Open
3 tasks done

[Nuxt]: Wrong issue environment tag #15623

priscilawebdev opened this issue Mar 10, 2025 · 3 comments
Assignees
Labels
Package: nuxt Issues related to the Sentry Nuxt SDK

Comments

@priscilawebdev
Copy link
Member

priscilawebdev commented Mar 10, 2025

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

9.5.0

Framework Version

No response

Link to Sentry event

https://sentry-pri-nuxt.sentry.io/issues/32395492/events/8dfaac86dd084cc19ec6cea251cf4958/

Reproduction Example/SDK Setup

No response

Steps to Reproduce

  1. Create a new Nuxt project by following the official guide here: Nuxt Installation Guide.
  2. Set up a new organization in Sentry.
  3. Create a new Nuxt project in Sentry.
  4. Use the Sentry wizard to instrument the Nuxt project.
  5. Run yarn dev to start the development environment.
  6. Trigger an error in the application.
  7. Go to the issue details in Sentry.
  8. The 'environment' tag should be set to 'dev'/'development' instead of 'production'.

Expected Result

The 'environment' tag should be set to 'dev'/'development' instead of 'production'.

Actual Result

Currently I am seeing 'production'

Image

Image

@github-actions github-actions bot added the Package: nuxt Issues related to the Sentry Nuxt SDK label Mar 10, 2025
@Lms24
Copy link
Member

Lms24 commented Mar 10, 2025

I think this is a larger issue than Nuxt because at this point, our SDKs don't universally auto-detect environemnt.

Most importantly, it's almost impossible to auto-detect dev vs prod reliably, especially in browser-side SDKs.

I checked various SDKs for environment default values:

  • In some SDKs we check process.env.NODE_ENV (e.g. remix),
  • in the Node SDK we allow users to set the SENTRY_ENVIRONMENT env variable.
  • In NextJS (server-side) we check for the vercel env
  • by default afaict, we don't set any environment tag which makes Relay set production

I actually don't know what the expected behaviour is and how SDKs of other languages handle this. We should investigate this further and ideally settle on common behaviour. Thanks for raising!

@s1gr1d
Copy link
Member

s1gr1d commented Mar 10, 2025

This is more about the dev mode environment, right?

Someone created a PR for Nuxt but we closed it as it was not finished (#15179). We can pick it up again but I think it would make sense to create a solution to detect the dev environment for all SDKs.

In the case of Nuxt, it's just looking for import.meta.dev as it is Vite-based. We could just check what's available during dev mode.

@s1gr1d s1gr1d self-assigned this Mar 10, 2025
@obostjancic obostjancic marked this as a duplicate of getsentry/sentry#86669 Mar 11, 2025
@Lms24
Copy link
Member

Lms24 commented Mar 11, 2025

heads-up: I took the liberty to re-classify this as an Improvement instead of a bug. So far this was somewhat "expected" SDK behaviour.

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
None yet
Development

No branches or pull requests

3 participants