Title: NextJS doesn't wrap API routes so DB Spans are only attached to root transaction · Issue #5779 · getsentry/sentry-javascript · GitHub
Open Graph Title: NextJS doesn't wrap API routes so DB Spans are only attached to root transaction · Issue #5779 · getsentry/sentry-javascript
X Title: NextJS doesn't wrap API routes so DB Spans are only attached to root transaction · Issue #5779 · 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/5779
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"NextJS doesn't wrap API routes so DB Spans are only attached to root transaction","articleBody":"### Is there an existing issue for this?\n\n- [X] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues\n- [X] I have reviewed the documentation https://docs.sentry.io/\n- [X] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases\n\n### How do you use Sentry?\n\nSentry Saas (sentry.io)\n\n### Which package are you using?\n\n@sentry/nextjs\n\n### SDK Version\n\n7.13\n\n### Framework Version\n\n12.3\n\n### Link to Sentry event\n\nhttps://sentry.io/organizations/adam-bl/performance/nextjs:9b1bb4037b9f4df8ab087b6521493df0/?project=6761253&query=&showTransactions=recent&statsPeriod=24h&transaction=GET+%2Fapi%2Freports&unselectedSeries=p100%28%29\n\n### Steps to Reproduce\n\n1. Build an API endpoint in Nextjs\r\n2. Use Prisma to load data\r\n3. Look at span in Sentry\r\n\r\n```\r\n// /api/reports.tsx\r\nconst handler = async (req, res) => {\r\n console.log(\"here\");\r\n let reports = await prisma.report.findMany({\r\n orderBy: { submittedDate: 'desc' }\r\n })\r\n\r\n for (const report of reports) {\r\n const expenses = await prisma.expense.findMany({\r\n where: { reportId: report.id }\r\n })\r\n }\r\n res.status(200).json({ reports })\r\n}\r\n\r\nexport default withSentry(handler);\r\n```\n\n### Expected Result\n\nDB spans would be nested under an API route\r\n\r\ntransaction\r\n /api/reports\r\n db.prisma\r\n db.prisma\r\n db.prisma\r\n db.prisma\r\n ...\n\n### Actual Result\n\n\u003cimg width=\"1374\" alt=\"Screen Shot 2022-09-20 at 7 12 43 AM\" src=\"https://user-images.githubusercontent.com/155016/191243407-2d354637-7188-4445-8b9f-3be12ec0a79f.png\">\r\n","author":{"url":"https://github.com/silent1mezzo","@type":"Person","name":"silent1mezzo"},"datePublished":"2022-09-20T11:12:56Z","url":"https://github.com/getsentry/sentry-javascript/issues/5779"}
| 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:6e81d17a-34f6-ad22-4f99-3365d289d6af |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | ABD2:21614F:94A5DD:D1B23F:6B042DD7 |
| html-safe-nonce | 8f7c89c1da6e5938b14d8c638351b80915b1fc1b8180f89dd40eae78ec4ce8b9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQkQyOjIxNjE0Rjo5NEE1REQ6RDFCMjNGOjZCMDQyREQ3IiwidmlzaXRvcl9pZCI6IjE3NDcyMDgxODU0NjAzMDUzNjciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | cf8f27c6d146aa3cbc4269c44931595fe4833351aceaf936c43acfcaba8a0a3f |
| hovercard-subject-tag | issue:1379241660 |
| 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/5779/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6b66f4fce7c28947da39c60bfb05b64fbdf843474acbe8587c9d936184698341/getsentry/sentry-javascript/issues/5779 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6b66f4fce7c28947da39c60bfb05b64fbdf843474acbe8587c9d936184698341/getsentry/sentry-javascript/issues/5779 |
| 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 | silent1mezzo |
| 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