Title: Not working from Next.js middleware (edge runtime) when not using `src` folder · Issue #9631 · getsentry/sentry-javascript · GitHub
Open Graph Title: Not working from Next.js middleware (edge runtime) when not using `src` folder · Issue #9631 · getsentry/sentry-javascript
X Title: Not working from Next.js middleware (edge runtime) when not using `src` folder · Issue #9631 · getsentry/sentry-javascript
Description: Environment SaaS (https://sentry.io/) Steps to Reproduce npx create-next-app sentry-test. Create a new NextJS app with default values except the src directory (select No) ✔ Would you like to use src/ directory? … No cd sentry-test. Enter...
Open Graph Description: Environment SaaS (https://sentry.io/) Steps to Reproduce npx create-next-app sentry-test. Create a new NextJS app with default values except the src directory (select No) ✔ Would you like to use sr...
X Description: Environment SaaS (https://sentry.io/) Steps to Reproduce npx create-next-app sentry-test. Create a new NextJS app with default values except the src directory (select No) ✔ Would you like to use sr...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/9631
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Not working from Next.js middleware (edge runtime) when not using `src` folder","articleBody":"### Environment\n\nSaaS (https://sentry.io/)\n\n### Steps to Reproduce\n\n1. `npx create-next-app sentry-test`. Create a new NextJS app with default values except the `src` directory (select `No`)\r\n - ✔ Would you like to use `src/` directory? … No \r\n3. `cd sentry-test`. Enter to the directory\r\n4. `npx @sentry/wizard@latest -i nextjs`. Run the sentry wizard\r\n5. create a `middleware.ts` file (inside ./) that sends some traces to sentry, for example:\r\n```ts\r\n// ./middleware.ts\r\nimport {NextResponse} from 'next/server';\r\nimport * as Sentry from '@sentry/nextjs';\r\n\r\nimport type {NextRequest} from 'next/server';\r\n\r\nexport const middleware = (request: NextRequest): NextResponse => {\r\n Sentry.captureException(new Error('Sentry Example Middleware Error'));\r\n Sentry.captureMessage('Sentry Example Middleware Message', {\r\n level: 'info',\r\n extra: {\r\n method: request.method,\r\n path: request.nextUrl.pathname,\r\n },\r\n });\r\n console.log(request.method + ' ' + request.nextUrl.pathname);\r\n return NextResponse.next();\r\n};\r\n```\r\n6. `yarn dev`. Run the dev server and open `http://localhost:3000`\n\n### Expected Result\n\nReceive issues from the middleware\r\n\r\nWe can verify that the middleware gets executed by looking at the console.logs from the terminal\n\n### Actual Result\n\nNot receiving issues from middleware\n\n### Product Area\n\nUnknown\n\n### Link\n\n_No response_\n\n### DSN\n\n_No response_\n\n### Version\n\n_No response_","author":{"url":"https://github.com/pladaria","@type":"Person","name":"pladaria"},"datePublished":"2023-11-21T16:20:05Z","url":"https://github.com/getsentry/sentry-javascript/issues/9631"}
| 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:ee92dd8e-513a-36cc-fb39-b595a230807f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C3B8:9D365:39EBC:4C8B0:6B042F9C |
| html-safe-nonce | a0510654701a71300b1d642ff64b535000d5c919b55723f2108c9d280777ede4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDM0I4OjlEMzY1OjM5RUJDOjRDOEIwOjZCMDQyRjlDIiwidmlzaXRvcl9pZCI6IjYzMzc1MTc3MzA3NDg3MDY3MTYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | eb2ca2f5fc80eb403760ca96355989b0dc9fdeda09928205026cc79b40974d2e |
| hovercard-subject-tag | issue:2005321117 |
| 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/9631/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a3ea9e2bcb9156a209f3d682c30d04ff904d47d88b3fc04336d31df712337aec/getsentry/sentry-javascript/issues/9631 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a3ea9e2bcb9156a209f3d682c30d04ff904d47d88b3fc04336d31df712337aec/getsentry/sentry-javascript/issues/9631 |
| og:image:alt | Environment SaaS (https://sentry.io/) Steps to Reproduce npx create-next-app sentry-test. Create a new NextJS app with default values except the src directory (select No) ✔ Would you like to use sr... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | pladaria |
| hostname | github.com |
| expected-hostname | github.com |
| None | b7a1d2b9101496921b08579fbee988d014345aef2f5bd660d1f8c7332d81560e |
| 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 | c3dd496c3da6ea6b77e69c09279d2b81604654f1 |
| 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