diff --git a/.env.example b/.env.example index aebaa89c72c289..d377318329cede 100644 --- a/.env.example +++ b/.env.example @@ -5,3 +5,4 @@ NEXT_PUBLIC_ALGOLIA_APP_ID= NEXT_PUBLIC_ALGOLIA_SEARCH_KEY= +NEXT_PUBLIC_SENTRY_DSN= \ No newline at end of file diff --git a/.gitignore b/.gitignore index 1080e5838761c0..ab63228404c131 100644 --- a/.gitignore +++ b/.gitignore @@ -50,9 +50,10 @@ typings/ # Output of 'npm pack' *.tgz -# dotenv environment variables file +# dotenv environment variables files .env -.env.development +.env.* +!.env.example # gatsby files .cache/ diff --git a/next.config.ts b/next.config.ts index 104aa5d27992dc..bef182894633df 100644 --- a/next.config.ts +++ b/next.config.ts @@ -1,8 +1,8 @@ import {codecovNextJSWebpackPlugin} from '@codecov/nextjs-webpack-plugin'; import {withSentryConfig} from '@sentry/nextjs'; -import {redirects} from './redirects.js'; import {REMOTE_IMAGE_PATTERNS} from './src/config/images'; +import {redirects} from './redirects.js'; const outputFileTracingExcludes = process.env.NEXT_PUBLIC_DEVELOPER_DOCS ? { @@ -40,12 +40,9 @@ const outputFileTracingExcludes = process.env.NEXT_PUBLIC_DEVELOPER_DOCS ], }; -if ( - process.env.NODE_ENV !== 'development' && - (!process.env.NEXT_PUBLIC_SENTRY_DSN || !process.env.SENTRY_DSN) -) { +if (process.env.NODE_ENV !== 'development' && !process.env.NEXT_PUBLIC_SENTRY_DSN) { throw new Error( - 'Missing required environment variables: NEXT_PUBLIC_SENTRY_DSN and SENTRY_DSN must be set in production' + 'Missing required environment variable: NEXT_PUBLIC_SENTRY_DSN must be set in production' ); } diff --git a/platform-includes/getting-started-complete/javascript.nuxt.mdx b/platform-includes/getting-started-complete/javascript.nuxt.mdx index fe981b2ce2e8ff..7f0bf5895a6383 100644 --- a/platform-includes/getting-started-complete/javascript.nuxt.mdx +++ b/platform-includes/getting-started-complete/javascript.nuxt.mdx @@ -110,7 +110,7 @@ export default defineNuxtConfig({ runtimeConfig: { public: { sentry: { - dsn: process.env.SENTRY_DSN_PUBLIC, // Use a public environment variable for the DSN + dsn: process.env.NUXT_PUBLIC_SENTRY_DSN, // Use a public environment variable for the DSN }, }, }, diff --git a/src/hotReloadWatcher.mjs b/src/hotReloadWatcher.mjs index 95ececbd89e87d..1998608510f7ef 100644 --- a/src/hotReloadWatcher.mjs +++ b/src/hotReloadWatcher.mjs @@ -1,4 +1,5 @@ import path from 'path'; + import {watch} from 'node:fs/promises'; import {WebSocketServer} from 'ws'; @@ -9,7 +10,7 @@ export const throttle = (fn, delay) => { return (...args) => { const now = Date.now(); if (now - last < delay) { - return; + return undefined; } last = now; return fn(...args); diff --git a/src/instrumentation.ts b/src/instrumentation.ts index 0605bfda1ff5c3..365ad6a80b9f81 100644 --- a/src/instrumentation.ts +++ b/src/instrumentation.ts @@ -3,7 +3,7 @@ import * as Sentry from '@sentry/nextjs'; export function register() { if (process.env.NEXT_RUNTIME === 'nodejs') { Sentry.init({ - dsn: process.env.SENTRY_DSN, + dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, tracesSampleRate: 1, enableLogs: true, debug: false, @@ -15,7 +15,7 @@ export function register() { if (process.env.NEXT_RUNTIME === 'edge') { Sentry.init({ - dsn: process.env.SENTRY_DSN, + dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, tracesSampleRate: 1, enableLogs: true, debug: false,