Replies: 1 comment 11 replies
-
Hey @Marcosld - so is the primary issue here that you want each environment to have their own DSN? One slight hack you can do here is insert the DSN via metadata - and then read the meta tag off the HTML to find the correct DSN. Would that work for you? |
Beta Was this translation helpful? Give feedback.
11 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, we have a webpage that runs over NextJS and we are looking forward to migrate it to the new
app/
folder to be able to use RSC. The main problem we are facing is configuring Sentry properly.We build our code a single time, and then deploy it over different environments. We used to pass environment config to sentry through https://nextjs.org/docs/app/api-reference/next-config-js/runtime-configuration, as all our pages use SSR. It seems like with
app/
folder in NextJS 13 this is no longer possible and environment variables must be read directly from process.env.As stated here https://nextjs.org/docs/app/building-your-application/configuring/environment-variables, environment variables prefixed with NEXT_PUBLIC (that are bundled automatically into the browser code) will be bundled in build time, so that's not an option for us.
Is it possible to read the environment variables on the server and then call Sentry.init manually on the client code instead of using
sentry.client.config.ts
file? Have you thought about supporting this some way on the future?Workarounds I've explored were:
sentry.client.config.ts
file.But none seems too convincing to me.
Beta Was this translation helpful? Give feedback.
All reactions