getsentry / sentry-javascript

Official Sentry SDKs for JavaScript
https://sentry.io
MIT License
7.97k stars 1.57k forks source link

@sentry/nextjs - sentry.client.config.js doesn't have access to runtime config #3485

Closed sophiekoonin closed 3 years ago

sophiekoonin commented 3 years ago

Package + Version

Version:

6.3.4

Description

I've just set up @sentry/nextjs on our Next app, but I'm having an issue with the client side implementation as it seems sentry.client.config.js doesn't have access to runtime config. It looks like getConfig() from next/config is undefined when Sentry initialises on the client.

We need to use publicRuntimeConfig because our app is built once but deployed across multiple environments, so we don't have the environment name at build time.

Minimal reproduction: CodeSandbox (NB. I set the withSentryConfig option silent: false to prevent my auth token being logged to console, even though it's just a test organisation!). Note the page is blank, and looking in the dev tools console (not the codesandbox console, the actual browser one) shows the error in question.

HazAT commented 3 years ago

Great issue! Thanks, we are looking into it.

HazAT commented 3 years ago

@sophiekoonin This should fix it https://github.com/getsentry/sentry-javascript/pull/3487

sophiekoonin commented 3 years ago

That was quick, thanks! I'll give that a go.

majewski-merix commented 1 year ago

It looks like this issue appears again. I've updated from 6.13.3 to 7.34.0 and I have the same problem. With version 7.33.0 everything is working