@sentry/nextjs: NEXT_PUBLIC_SENTRY_DSN is not used
See original GitHub issue- Review the documentation: https://docs.sentry.io/
- Search for existing issues: https://github.com/getsentry/sentry-javascript/issues
- Use the latest release: https://github.com/getsentry/sentry-javascript/releases
- Provide a link to the affected event from your Sentry account
Package + Version
@sentry/nextjs
@ 6.4.0@sentry/tracing
@ 6.4.0
Description
According to a note at the end of the manual setup guide, you can use either the SENTRY_DSN
or NEXT_PUBLIC_SENTRY_DSN
environment variable to set Sentry’s DSN.
Setting NEXT_PUBLIC_SENTRY_DSN
(such as through the official Sentry/Vercel integration) doesn’t configure the DSN. It appears that NEXT_PUBLIC_SENTRY_DSN
isn’t referenced at all in the code, and SENTRY_DSN
only appears to be supported by @sentry/node
, leaving the client-side unconfigured.
Ideally, @sentry/nextjs
would be updated to utilise these variables, or the documentation updated to remove this information.
Our current solution is to explicitly specify the DSN in sentry.client.config.js
and sentry.server.config.js
:
Sentry.init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
// ...
})
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Manual Setup for Next.js - Sentry Documentation
Manual Setup. If you can't (or prefer not to) run the configuration step, you can follow the instructions below to configure your application....
Read more >Sentry NextJS only work when the error occurs on the server ...
I must not only set a SENTRY_DSN because that'll only work in the server, but also NEXT_PUBLIC_SENTRY_DSN because that will be allowed by...
Read more >@sentry/nextjs - npm
This package is a wrapper around @sentry/node for the server and @sentry/react for the client, with added functionality related to Next.js. To ...
Read more >integrating Sentry in Next.js project - Stack Overflow
I am using Next.js with AMP. That means my code runs only on the server. no client code. I'm trying to integrate @sentry/node...
Read more >Top 5 @sentry/node Code Examples - Snyk
To help you get started, we've selected a few @sentry/node examples, based on popular ways it is used in public projects. Secure your...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@AsherFoster yes, converted the docs PR to draft since this will be supported. I’ll keep this updated, and thanks for the feedback!
We use the
NEXT_PUBLIC_SENTRY_DSN
in the config file we create with the wizard see: https://github.com/getsentry/sentry-wizard/blob/master/scripts/NextJs/configs/sentry.client.config.js so we pick it up and use it if it’s there.