Title: TypeError when running Next.js app with middleware and latest @sentry/nextjs package · Issue #8416 · getsentry/sentry-javascript · GitHub
Open Graph Title: TypeError when running Next.js app with middleware and latest @sentry/nextjs package · Issue #8416 · getsentry/sentry-javascript
X Title: TypeError when running Next.js app with middleware and latest @sentry/nextjs package · Issue #8416 · 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/8416
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"TypeError when running Next.js app with middleware and latest @sentry/nextjs package","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 SDK are you using?\r\n\r\n@sentry/nextjs\r\n\r\n### SDK Version\r\n\r\n7.56.0\r\n\r\n### Framework Version\r\n\r\n18.2.0\r\n\r\n### NextJs Version\r\n\r\n13.3.0\r\n\r\n### Link to Sentry event\r\n\r\nhttps://the-issue.sentry.io/issues/4280470356/events/7bda08795e7f48a1aad62e56be27ad80/\r\n\r\n### SDK Setup\r\nsentry.edge.config.ts\r\n```typescript\r\nimport * as Sentry from '@sentry/nextjs'\r\n\r\nSentry.init({\r\n dsn: SENTRY_DNS,\r\n tracesSampleRate: 1,\r\n debug: false,\r\n})\r\n\r\n```\r\nsentry.server.config.ts\r\n```typescript\r\nimport * as Sentry from '@sentry/nextjs'\r\nSentry.init({\r\n dsn: SENTRY_DNS,\r\n tracesSampleRate: 1,\r\n debug: false,\r\n})\r\n```\r\nsentry.client.config.ts\r\n```typescript\r\nimport * as Sentry from '@sentry/nextjs'\r\nSentry.init({\r\n dsn: SENTRY_DNS,\r\n tracesSampleRate: 1,\r\n debug: false,\r\n replaysOnErrorSampleRate: 1.0,\r\n replaysSessionSampleRate: 0.1,\r\n integrations: [\r\n new Sentry.Replay({\r\n maskAllText: true,\r\n blockAllMedia: true,\r\n }),\r\n ],\r\n})\r\n```\r\n\r\n\r\n### Steps to Reproduce\r\n\r\n1. Create a middleware.ts file in any nextjs project (`npx create-next-app@latest`) with a simple middleware handler:\r\n```\r\nexport default async function middleware() {\r\n return NextResponse.next()\r\n}\r\n```\r\n2. run sentry wizard to initialize npx @sentry/wizard -i nextjs\r\n3. run yarn dev\r\n4. enter to any page\r\n\r\nThis same error happened in this issue #6858 but the fix they added seems not to work on my side. \r\n\r\n### Expected Result\r\n\r\nEnter to the page without any error.\r\n\r\n### Actual Result\r\n\r\n```\r\nerror - sentry-wrapper-module (33:63) @ eval\r\nerror - Error [TypeError]: _sentry_nextjs__WEBPACK_IMPORTED_MODULE_1__.wrapMiddlewareWithSentry is not a function\r\n at eval (webpack-internal:///./middleware.ts:86:108)\r\n at Object../middleware.ts (/Users/facundocastello/projects/deckhand/.next/server/pages/_app.js:22:1)\r\n at __webpack_require__ (/Users/facundocastello/projects/deckhand/.next/server/webpack-runtime.js:33:42)\r\n at eval (webpack-internal:///./helpers/tenant.ts:12:69)\r\n at Object../helpers/tenant.ts (/Users/facundocastello/projects/deckhand/.next/server/pages/_app.js:164:1)\r\n at __webpack_require__ (/Users/facundocastello/projects/deckhand/.next/server/webpack-runtime.js:33:42)\r\n at eval (webpack-internal:///./contexts/CampaignContext.tsx:9:73)\r\n at Object../contexts/CampaignContext.tsx (/Users/facundocastello/projects/deckhand/.next/server/pages/_app.js:87:1)\r\n at __webpack_require__ (/Users/facundocastello/projects/deckhand/.next/server/webpack-runtime.js:33:42)\r\n at eval (webpack-internal:///./pages/_app.tsx:18:83)\r\n at Function.__webpack_require__.a (/Users/facundocastello/projects/deckhand/.next/server/webpack-runtime.js:97:13)\r\n at eval (webpack-internal:///./pages/_app.tsx:1:21)\r\n at Object../pages/_app.tsx (/Users/facundocastello/projects/deckhand/.next/server/pages/_app.js:33:1)\r\n at __webpack_require__ (/Users/facundocastello/projects/deckhand/.next/server/webpack-runtime.js:33:42)\r\n at __webpack_exec__ (/Users/facundocastello/projects/deckhand/.next/server/pages/_app.js:470:39)\r\n at /Users/facundocastello/projects/deckhand/.next/server/pages/_app.js:471:75\r\n at Object.\u003canonymous> (/Users/facundocastello/projects/deckhand/.next/server/pages/_app.js:474:3)\r\n at Module._compile (node:internal/modules/cjs/loader:1126:14)\r\n at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)\r\n at Module.load (node:internal/modules/cjs/loader:1004:32)\r\n at Function.Module._load (node:internal/modules/cjs/loader:839:12)\r\n at Module.require (node:internal/modules/cjs/loader:1028:19)\r\n at require (node:internal/modules/cjs/helpers:102:18)\r\n at Object.requirePage (/Users/facundocastello/projects/deckhand/node_modules/next/dist/server/require.js:134:12)\r\n at /Users/facundocastello/projects/deckhand/node_modules/next/dist/server/load-components.js:48:54\r\n at processTicksAndRejections (node:internal/process/task_queues:96:5)\r\n at async Promise.all (index 1)\r\n at async Object.loadComponentsImpl [as loadComponents] (/Users/facundocastello/projects/deckhand/node_modules/next/dist/server/load-components.js:46:33)\r\n at async DevServer.findPageComponentsImpl (/Users/facundocastello/projects/deckhand/node_modules/next/dist/server/next-server.js:667:36) {\r\n digest: undefined\r\n}\r\n 31 | ? Sentry.wrapMiddlewareWithSentry(userProvidedNamedHandler)\r\n 32 | : undefined;\r\n> 33 | const middlewareWrapperTemplate = userProvidedDefaultHandler ? Sentry.wrapMiddlewareWithSentry(userProvidedDefaultHandler) : undefined;\r\n | ^\r\n 34 | \r\n 35 | export { middlewareWrapperTemplate as default, middleware };\r\n 36 | \r\n```\r\n\u003cimg width=\"1738\" alt=\"image\" src=\"https://github.com/getsentry/sentry-javascript/assets/9084789/93df09f6-c45c-41a6-a85f-efa16df730bc\">\r\n\r\nI'm getting this exact error also when I deploy it to vercel, so it's not just a local error.","author":{"url":"https://github.com/facundocastello","@type":"Person","name":"facundocastello"},"datePublished":"2023-06-28T12:12:44Z","url":"https://github.com/getsentry/sentry-javascript/issues/8416"}
| 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:374b6ea2-a939-0bae-361c-109601994111 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D5DA:4FA7:176276:1F0E6B:6B04A1E1 |
| html-safe-nonce | 2d684e07fcc135e5f620d294918f2fcb99984b712791af45da7229fe59388a95 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENURBOjRGQTc6MTc2Mjc2OjFGMEU2Qjo2QjA0QTFFMSIsInZpc2l0b3JfaWQiOiI3MTAzOTY2NDc3MzU0ODM2NDQ5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | d1de65c2c1e1eeb6e77567a94a30d6542333f2d9ce0996450e90381a07505a96 |
| hovercard-subject-tag | issue:1778814594 |
| 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/8416/issue_layout |
| twitter:image | https://opengraph.githubassets.com/66d4cc830402124f4f568c635cc268e75dd5c35e2f52435d288345e3d23d6264/getsentry/sentry-javascript/issues/8416 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/66d4cc830402124f4f568c635cc268e75dd5c35e2f52435d288345e3d23d6264/getsentry/sentry-javascript/issues/8416 |
| 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 | facundocastello |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9784b6f42e2d5eac4e394fa88cad134c0dc5b6662b4ff2787a1ed1ef5a96331d |
| 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 | 3fd14143b75b2af7b76bbd23b069867d091adfcc |
| 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