Skip to content

Commit f03e3f1

Browse files
authored
fix(Platform) consolidate to one env variable for Sentry DSN (#15010)
* Remove `SENTRY_DSN` env variable * Fix errors for `yarn lint` * Update docs for framework convensions
1 parent 19f2aea commit f03e3f1

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55

66
NEXT_PUBLIC_ALGOLIA_APP_ID=
77
NEXT_PUBLIC_ALGOLIA_SEARCH_KEY=
8+
NEXT_PUBLIC_SENTRY_DSN=

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@ typings/
5050
# Output of 'npm pack'
5151
*.tgz
5252

53-
# dotenv environment variables file
53+
# dotenv environment variables files
5454
.env
55-
.env.development
55+
.env.*
56+
!.env.example
5657

5758
# gatsby files
5859
.cache/

next.config.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import {codecovNextJSWebpackPlugin} from '@codecov/nextjs-webpack-plugin';
22
import {withSentryConfig} from '@sentry/nextjs';
33

4-
import {redirects} from './redirects.js';
54
import {REMOTE_IMAGE_PATTERNS} from './src/config/images';
5+
import {redirects} from './redirects.js';
66

77
const outputFileTracingExcludes = process.env.NEXT_PUBLIC_DEVELOPER_DOCS
88
? {
@@ -40,12 +40,9 @@ const outputFileTracingExcludes = process.env.NEXT_PUBLIC_DEVELOPER_DOCS
4040
],
4141
};
4242

43-
if (
44-
process.env.NODE_ENV !== 'development' &&
45-
(!process.env.NEXT_PUBLIC_SENTRY_DSN || !process.env.SENTRY_DSN)
46-
) {
43+
if (process.env.NODE_ENV !== 'development' && !process.env.NEXT_PUBLIC_SENTRY_DSN) {
4744
throw new Error(
48-
'Missing required environment variables: NEXT_PUBLIC_SENTRY_DSN and SENTRY_DSN must be set in production'
45+
'Missing required environment variable: NEXT_PUBLIC_SENTRY_DSN must be set in production'
4946
);
5047
}
5148

platform-includes/getting-started-complete/javascript.nuxt.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export default defineNuxtConfig({
110110
runtimeConfig: {
111111
public: {
112112
sentry: {
113-
dsn: process.env.SENTRY_DSN_PUBLIC, // Use a public environment variable for the DSN
113+
dsn: process.env.NUXT_PUBLIC_SENTRY_DSN, // Use a public environment variable for the DSN
114114
},
115115
},
116116
},

src/hotReloadWatcher.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import path from 'path';
2+
23
import {watch} from 'node:fs/promises';
34
import {WebSocketServer} from 'ws';
45

@@ -9,7 +10,7 @@ export const throttle = (fn, delay) => {
910
return (...args) => {
1011
const now = Date.now();
1112
if (now - last < delay) {
12-
return;
13+
return undefined;
1314
}
1415
last = now;
1516
return fn(...args);

src/instrumentation.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as Sentry from '@sentry/nextjs';
33
export function register() {
44
if (process.env.NEXT_RUNTIME === 'nodejs') {
55
Sentry.init({
6-
dsn: process.env.SENTRY_DSN,
6+
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
77
tracesSampleRate: 1,
88
enableLogs: true,
99
debug: false,
@@ -15,7 +15,7 @@ export function register() {
1515

1616
if (process.env.NEXT_RUNTIME === 'edge') {
1717
Sentry.init({
18-
dsn: process.env.SENTRY_DSN,
18+
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
1919
tracesSampleRate: 1,
2020
enableLogs: true,
2121
debug: false,

0 commit comments

Comments
 (0)