-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
NextJS 11 withSentryConfig returns a function when it should return an object #3722
Comments
This was due to this PR #3698 Which in reality. The issue was how my next.config.js was setup. What I was doing was running Before:
After:
This was a pretty big breaking change for us... probably because we were doing things wrong initially but it's bound to bite additional people |
@tm1000 - Thanks for pointing this out. In that PR I changed |
…ype (#3760) When fixing https://github.com/getsentry/sentry-docs/issues/3723, the return type of `withSentryConfig` was changed from an object to a function which returns an object, since otherwise there's no way to get the `phase` and `defaultConfig` arguments needed when the user passes their existing nextjs config as a function. If users follow our instructions in https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/, and export `withSentryConfig(...)` with no further modifications, this is an invisible change, since they're never dealing with its return value. But for any who do further process said value, it turns out to have been a potentially breaking change. This reverts to the old behavior (of returning an object) in cases where the existing config is an object, and only returns a function when necessary, which is to say, when the existing config is itself a function. Fixes #3722.
Package + Version
@sentry/browser
@sentry/node
raven-js
raven-node
(raven for node)@sentry/nextjs
Version:
Description
Utilizing https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
withSentryConfig
is returned directly into module.exports. However it's a function at this level and needs to be executed when sent to module.exports to actually send the settings to NextJS. Otherwise it's just a function that nextjs never exports. This actually ends up breaking any settings anyone has added in Next.config.js because once withSentryConfig does this then nextjs sees theres no webpack key on the object sent to module.exportsThe text was updated successfully, but these errors were encountered: