Title: createReduxEnhancer is not a function when using @sentry/nextjs with sentryReduxEnhancer · Issue #7040 · getsentry/sentry-javascript · GitHub
Open Graph Title: createReduxEnhancer is not a function when using @sentry/nextjs with sentryReduxEnhancer · Issue #7040 · getsentry/sentry-javascript
X Title: createReduxEnhancer is not a function when using @sentry/nextjs with sentryReduxEnhancer · Issue #7040 · getsentry/sentry-javascript
Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using the latest SDK release https://github.com/...
Open Graph Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th...
X Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/7040
X: @github
Domain: github.com
IPv4 address: 140.82.112.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"createReduxEnhancer is not a function when using @sentry/nextjs with sentryReduxEnhancer","articleBody":"### Is there an existing issue for this?\r\n\r\n- [X] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues\r\n- [X] I have reviewed the documentation https://docs.sentry.io/\r\n- [X] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases\r\n\r\n### How do you use Sentry?\r\n\r\nSentry Saas (sentry.io)\r\n\r\n### Which package are you using?\r\n\r\n@sentry/nextjs\r\n\r\n### SDK Version\r\n\r\n7.33\r\n\r\n### Framework Version\r\n\r\nNext 12.3.4\r\n\r\n### Link to Sentry event\r\n\r\nhttps://nomanini-1w.sentry.io/issues/3887540095/?environment=development&project=5239130&query=is%3Aunresolved&referrer=issue-stream\r\n\r\n### SDK Setup\r\n\r\n## Client\r\n\r\n```ts\r\n// This file configures the initialization of Sentry on the browser.\r\n// The config you add here will be used whenever a page is visited.\r\n// https://docs.sentry.io/platforms/javascript/guides/nextjs/\r\n\r\nimport * as Sentry from '@sentry/nextjs'\r\n\r\nconst SENTRY_DSN = process.env.SENTRY_DSN || process.env.NEXT_PUBLIC_SENTRY_DSN\r\n\r\nSentry.init({\r\n dsn: SENTRY_DSN',\r\n tracesSampleRate: process.env.NODE_ENV === 'production' ? 0.1 : 0.3,\r\n environment: process.env.NODE_ENV,\r\n // ...\r\n // Note: if you want to override the automatic release value, do not set a\r\n // `release` value here - use the environment variable `SENTRY_RELEASE`, so\r\n // that it will also get attached to your source maps\r\n})\r\n```\r\n\r\n## Server\r\n\r\n```\r\n// This file configures the initialization of Sentry on the server.\r\n// The config you add here will be used whenever the server handles a request.\r\n// https://docs.sentry.io/platforms/javascript/guides/nextjs/\r\n\r\nimport * as Sentry from '@sentry/nextjs'\r\n\r\nconst SENTRY_DSN = process.env.SENTRY_DSN || process.env.NEXT_PUBLIC_SENTRY_DSN\r\n\r\nSentry.init({\r\n dsn: SENTRY_DSN,\r\n tracesSampleRate: process.env.NODE_ENV === 'production' ? 0.1 : 0.3,\r\n environment: process.env.NODE_ENV,\r\n // ...\r\n // Note: if you want to override the automatic release value, do not set a\r\n // `release` value here - use the environment variable `SENTRY_RELEASE`, so\r\n // that it will also get attached to your source maps\r\n})\r\n```\r\n\r\n### Steps to Reproduce\r\n\r\nWhen I `import * as Sentry from @sentry/nextjs` and run this\r\n\r\n```\r\nconst sentryReduxEnhancer = Sentry.createReduxEnhancer({\r\n stateTransformer: (state: RootState) => {\r\n const transformedState = {\r\n ...state,\r\n auth: {\r\n session: {\r\n ...state.auth.session,\r\n token: null,\r\n },\r\n },\r\n }\r\n\r\n return transformedState\r\n },\r\n})\r\n\r\n\r\nexport const setupStore = (preloadedState?: PreloadedState\u003cRootState>) => {\r\n return configureStore({\r\n ...,\r\n enhancers: [sentryReduxEnhancer],\r\n}\r\n\r\n```\r\n\r\nI get `createReduxEnhancer is not a function` error.\r\n\r\nHowever, it works when I `import * as Sentry from @sentry/react`. \r\n\r\nI'm thinking it's because it thinks it's in a server context so @sentry/nextjs is using @sentry/node instead of @sentry/react\r\n\r\n### Expected Result\r\n\r\nI can us `import * as Sentry from @sentry/nextjs` with `Sentry.createReduxEnhancer` and I do not get `createReduxEnhancer is not a function` error.\r\n\r\n### Actual Result\r\n\r\n`TypeError: createReduxEnhancer is not a function`","author":{"url":"https://github.com/DominicGBauer","@type":"Person","name":"DominicGBauer"},"datePublished":"2023-02-02T12:39:39Z","url":"https://github.com/getsentry/sentry-javascript/issues/7040"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b40f75aa-8573-983c-e162-5a0cb8bfa75b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 986C:380E13:19638CB:2229ACD:6B03FAF1 |
| html-safe-nonce | c828a7d503233559d08bfd1a0eab9c43b257192de46a7228ba9e188dc75776a7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5ODZDOjM4MEUxMzoxOTYzOENCOjIyMjlBQ0Q6NkIwM0ZBRjEiLCJ2aXNpdG9yX2lkIjoiNzc4MTYzMjQzODg2MTgyMjcwNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | d437e865d177dd408aa3c8b6f3941a6c9203623661724f09c47e9169e9c0d454 |
| hovercard-subject-tag | issue:1567983048 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/7040/issue_layout |
| twitter:image | https://opengraph.githubassets.com/66ab8c318b70e1aad996a93f3e1b0c3461543707753ba9fe42e6c8e844d3ff91/getsentry/sentry-javascript/issues/7040 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/66ab8c318b70e1aad996a93f3e1b0c3461543707753ba9fe42e6c8e844d3ff91/getsentry/sentry-javascript/issues/7040 |
| og:image:alt | Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | DominicGBauer |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width