- 
 
- 
  Notifications
 You must be signed in to change notification settings 
- Fork 1.7k
-
Hi,
We define our environment and our DSN variables in Azure environments or App Settings:
Then we access them from sentry.config.ts file:
import * as Sentry from "@sentry/nextjs" Sentry.init({ environment: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT, dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, // Adjust this value in production, or use tracesSampler for greater control tracesSampleRate: 1, // Setting this option to true will print useful information to the console while you're setting up Sentry. debug: false, replaysOnErrorSampleRate: 1.0, // This sets the sample rate to be 10%. You may want this to be 100% while // In development and sample at a lower rate in production replaysSessionSampleRate: 0.1, })
and in our .env.production:
NEXT_PUBLIC_SENTRY_DSN= NEXT_PUBLIC_SENTRY_ENVIRONMENT=
However, as we know Next.js bundle these variables during the build process and inject them, I expect that they will not be accessible if we define them in Azure Environment from Sentry client configuration file because the initial value was empty, and we have to define them in the environment files.
Beta Was this translation helpful? Give feedback.
All reactions
Any env variables prefixed with NEXT_PUBLIC_ should be available in your sentry.client.config.ts file.
Replies: 1 comment 1 reply
-
Any env variables prefixed with NEXT_PUBLIC_ should be available in your sentry.client.config.ts file.
Beta Was this translation helpful? Give feedback.
All reactions
-
Thank you @lforst , however, we can not define them in App Settings (System Variables) but only from the pipeline environments.variables.
Beta Was this translation helpful? Give feedback.