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

The import.meta.env.MODE always resolves to development #13301

Closed
3 tasks done
pawelgrzybek opened this issue Aug 11, 2024 · 2 comments
Closed
3 tasks done

The import.meta.env.MODE always resolves to development #13301

pawelgrzybek opened this issue Aug 11, 2024 · 2 comments
Labels
Package: astro Issues related to the Sentry Astro SDK

Comments

@pawelgrzybek
Copy link

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/astro

SDK Version

8.19.0

Framework Version

Astro 4.13.0

Link to Sentry event

No response

Reproduction Example/SDK Setup

import { defineConfig } from "astro/config";
import netlify from "@astrojs/netlify";

import sentry from "@sentry/astro";

// https://astro.build/config
export default defineConfig({
  output: "hybrid",
  adapter: netlify(),
  integrations: [
    sentry({
      dsn: "***",
      environment: import.meta.env.MODE, // 👈 👈 👈
      sourceMapsUploadOptions: {
        project: "website",
        authToken: process.env.SENTRY_AUTH_TOKEN,
      },
    }),
  ],
});

Steps to Reproduce

Any exception on the website logged to Sentry comes back with development env meta data.

Sentry.captureMessage("Example");

Expected Result

As per the Astro documentation, I would expect import.meta.env.MODE to resolve to "development" for astro dev and "production" for astro build.

Actual Result

Always resolves to "development".

@s1gr1d
Copy link
Member

s1gr1d commented Aug 12, 2024

Hello, those environment variables are coming from Astro. I just tested it in an example Astro project without Sentry and could reproduce it. As this is not Sentry-related, you could file an issue with a reproduction in the Astro repository. There is also a recent issue about this: withastro/astro#11282

Thanks for reaching out anyways. I will close this issue for now, as this cannot be fixed on our side.

@pawelgrzybek
Copy link
Author

Thanks a lot for your comment @s1gr1d very helpful! I am going to reopen this bug on astro repo, as the current one has been closed by automated system due to a lack of reproduction link. I made one: https://stackblitz.com/edit/github-qyxzsr

Have a fab day @s1gr1d

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

No branches or pull requests

2 participants