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

Migrating to @sentry/nextjs (removing @sentry/browser and @sentry/node) #370

Draft
wants to merge 39 commits into
base: v2-mst-aptd-at-lcz-sty
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
f86c19f
Configure @sentry/next using "npx @sentry/wizard -i nextjs" + removed…
Vadorequest Jun 10, 2021
5d526cf
Misc
Vadorequest Jun 10, 2021
0cd0cd7
Use @sentry/nextjs instead of @sentry/node
Vadorequest Jun 10, 2021
42f1d48
Merge branch 'v2-mst-aptd-at-lcz-sty' into next-sentry
Vadorequest Jun 10, 2021
0d5baee
Remove log
Vadorequest Jun 10, 2021
105afbd
Add example showing the Sentry report dialog
Vadorequest Jun 10, 2021
8389f3a
Reorder env vars
Vadorequest Jun 10, 2021
17db210
Add NEXT_PUBLIC_SENTRY_DSN
Vadorequest Jun 10, 2021
814c6b1
Move withSentryConfig webpack plugin AFTER withNextPluginPreval, othe…
Vadorequest Jun 10, 2021
0018b80
Remove log
Vadorequest Jun 10, 2021
7a35307
Adapt doc for other people not to fall in the same trap
Vadorequest Jun 10, 2021
be57969
Improve interactive error demo + fix TS errors
Vadorequest Jun 10, 2021
5c82a99
Add vercel secret nrn-sentry-auth-token
Vadorequest Jun 10, 2021
8cc7c3a
Use withSentry HOC for error, too
Vadorequest Jun 10, 2021
0940f3c
Enable debug mode
Vadorequest Jun 14, 2021
0a2fd8e
Merge branch 'v2-mst-aptd-at-lcz-sty' into next-sentry
Vadorequest Jun 24, 2021
c3d1553
Fix issues
Vadorequest Jun 24, 2021
002c54e
Import sentry from @sentry/nextjs
Vadorequest Jun 24, 2021
dc67f66
Log full error
Vadorequest Jun 24, 2021
84e4574
Attempt try/catch flushing
Vadorequest Jun 24, 2021
fbc7002
Use withSentry for all API endpoints + remove try/catch
Vadorequest Jun 24, 2021
1d01078
Refacto
Vadorequest Jun 24, 2021
12bfda6
Add tracesSampleRate
Vadorequest Jun 24, 2021
1c2a56e
Merge branch 'v2-mst-aptd-at-lcz-sty' into next-sentry
Vadorequest Jun 24, 2021
edd621f
Merge branch 'v2-mst-aptd-at-lcz-sty' into next-sentry
Vadorequest Jun 24, 2021
204d53f
Use '@sentry/nextjs' instead of @sentry/node'
Vadorequest Jun 24, 2021
abfe455
Merge branch 'v2-mst-aptd-at-lcz-sty' into next-sentry
Vadorequest Jun 24, 2021
599f5ed
Add more doc + make Sentry silent
Vadorequest Jun 24, 2021
f70a44d
Merge branch 'v2-mst-aptd-at-lcz-sty' into next-sentry
Vadorequest Jun 25, 2021
5ba6c1b
Avoid duplicating config between browser/server
Vadorequest Jun 25, 2021
f9571d8
Use NEXT_PUBLIC_SENTRY_DSN + add test
Vadorequest Jun 25, 2021
d285b72
Wrap all API endpoint with Sentry.withSentry
Vadorequest Jun 25, 2021
dbe2325
Test Vercel ENV (unrelated)
Vadorequest Jun 25, 2021
6e4b9b4
Test Vercel ENV (unrelated)
Vadorequest Jun 25, 2021
fbd279f
Avoids capturing false-positive 404 pages when building the 404 page
Vadorequest Jun 25, 2021
8fdc4ce
Use build-env
Vadorequest Jun 25, 2021
3df2809
Fix debug mode
Vadorequest Jun 25, 2021
c0f84e2
Reset deploy env vars
Vadorequest Jun 25, 2021
f681da0
Use dryRun in development mode
Vadorequest Jun 25, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Avoid duplicating config between browser/server
Vadorequest committed Jun 25, 2021

Verified

This commit was signed with the committer’s verified signature.
commit 5ba6c1b316e90b426878a42d95b0f43c1ee1eca9
17 changes: 1 addition & 16 deletions sentry.client.config.js
Original file line number Diff line number Diff line change
@@ -2,19 +2,4 @@
// The config you add here will be used whenever a page is visited.
// https://docs.sentry.io/platforms/javascript/guides/nextjs/

import * as Sentry from '@sentry/nextjs';
import { configureSentry } from './src/modules/core/sentry/init';

Sentry.init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
enabled: process.env.NODE_ENV !== 'test',
environment: process.env.NEXT_PUBLIC_APP_STAGE,
debug: process.env.NODE_ENV === 'development', // You'll need to configure "debug" in sentry.x.config.js files as well as next.config.js
tracesSampleRate: 1.0,

// Note: if you want to override the automatic release value, do not set a
// `release` value here - use the environment variable `SENTRY_RELEASE`, so
// that it will also get attached to your source maps
});

configureSentry();
import './src/modules/core/sentry/init';
17 changes: 1 addition & 16 deletions sentry.server.config.js
Original file line number Diff line number Diff line change
@@ -2,19 +2,4 @@
// The config you add here will be used whenever the server handles a request.
// https://docs.sentry.io/platforms/javascript/guides/nextjs/

import * as Sentry from '@sentry/nextjs';
import { configureSentry } from './src/modules/core/sentry/init';

Sentry.init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
enabled: process.env.NODE_ENV !== 'test',
environment: process.env.NEXT_PUBLIC_APP_STAGE,
debug: process.env.NODE_ENV === 'development', // You'll need to configure "debug" in sentry.x.config.js files as well as next.config.js
tracesSampleRate: 1.0,

// Note: if you want to override the automatic release value, do not set a
// `release` value here - use the environment variable `SENTRY_RELEASE`, so
// that it will also get attached to your source maps
});

configureSentry();
import './src/modules/core/sentry/init';
4 changes: 3 additions & 1 deletion src/modules/core/sentry/init.ts
Original file line number Diff line number Diff line change
@@ -30,7 +30,9 @@ if (process.env.NEXT_PUBLIC_SENTRY_DSN) {
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
enabled: process.env.NODE_ENV !== 'test',
environment: process.env.NEXT_PUBLIC_APP_STAGE,
release: process.env.NEXT_PUBLIC_APP_VERSION_RELEASE,
// release: process.env.NEXT_PUBLIC_APP_VERSION_RELEASE, // Uses the environment variable `SENTRY_RELEASE`, which is also attached to the source maps
debug: process.env.NODE_ENV === 'development', // You'll need to configure "debug" in sentry.x.config.js files as well as next.config.js
tracesSampleRate: 1.0,
});

Sentry.configureScope((scope) => {