Skip to content

Conversation

@lobsterkatie
Copy link
Member

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 here, 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.

@github-actions
Copy link
Contributor

size-limit report

Path Size
@sentry/browser - CDN Bundle (gzipped) 21.39 KB (0%)
@sentry/browser - Webpack 22.4 KB (0%)
@sentry/react - Webpack 22.44 KB (0%)
@sentry/browser + @sentry/tracing - CDN Bundle (gzipped) 28.88 KB (0%)

@lobsterkatie lobsterkatie merged commit 01bb58d into master Jun 29, 2021
@lobsterkatie lobsterkatie deleted the kmclb-nextjs-match-config-output-type branch June 29, 2021 13:33
1999 added a commit to 1999/sentry-javascript that referenced this pull request Jun 30, 2021
…transport

* upstream/master:
  fix(tracing): Add check for document.scripts in metrics (getsentry#3766)
  ref(nextjs): Stop setting redundant `productionBrowserSourceMaps` in config (getsentry#3765)
  test: Ensure withScope and run bubble up exceptions (getsentry#3764)
  ref(gatsby): Default release to empty string (getsentry#3759)
  fix(nextjs): Make `withSentryConfig` return type match given config type (getsentry#3760)
  misc: Fix typos (getsentry#3763)
  fix(node): Enable autoSessionTracking correctly (getsentry#3758)
  release: 6.8.0
  meta: 6.8.0 changelog
  feat: Enable serialization of multiple DOM attributes for breadcrumbs. (getsentry#3755)
  ref: Leave only valid buffer implementation (getsentry#3744)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NextJS 11 withSentryConfig returns a function when it should return an object

3 participants