Title: `@sentry/nextjs` `7.15` and `7.16` have issues with `@vercel/nft` · Issue #5998 · getsentry/sentry-javascript · GitHub
Open Graph Title: `@sentry/nextjs` `7.15` and `7.16` have issues with `@vercel/nft` · Issue #5998 · getsentry/sentry-javascript
X Title: `@sentry/nextjs` `7.15` and `7.16` have issues with `@vercel/nft` · Issue #5998 · 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/5998
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`@sentry/nextjs` `7.15` and `7.16` have issues with `@vercel/nft`","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.15.0 / 7.16.0\r\n\r\n### Framework Version\r\n\r\nNext 12.3.1\r\n\r\n### Link to Sentry event\r\n\r\n_No response_\r\n\r\n### Steps to Reproduce\r\n\r\nWhen upgrading [blockprotocol/blockprotocol](https://github.com/blockprotocol/blockprotocol) from `@sentry/nextjs@7.13.0` to `7.15.0` or `7.16.0`, my app started responding with 500 on Vercel. It was working fine locally, which did not make sense at first. I managed to link this problem to [`@vercel/nft`](https://www.npmjs.com/package/@vercel/nft) (part of Next.js) and created an MWE here:\r\nhttps://github.com/hasharchives/sentry-vercel-nft-issue/branches/all\r\n\r\nThe bug it is to do with Sentry corrupting `*.nft.json` build files.\r\n\r\nThe default `no-sentry` branch in my MWE contains a simple Next.js app that consists of a [page with `getServerSideProps`](https://github.com/hasharchives/sentry-vercel-nft-issue/blob/no-sentry/pages/index.js) and an [API route](https://github.com/hasharchives/sentry-vercel-nft-issue/blob/no-sentry/pages/api/hello.js). Both files read [`data.json`](https://github.com/hasharchives/sentry-vercel-nft-issue/blob/no-sentry/data.json) in the repo root. When the app is built, Next creates `.next/server/pages/**/*.nft.json` files which are then used on Vercel to determine which files to include in which lambdas. These files are normally `.gitignore`-ed but I’ve added them to the MWE repo:\r\n\r\n- [`no-sentry` .next/server/pages/index.js.nft.json](https://github.com/hasharchives/sentry-vercel-nft-issue/blob/no-sentry/.next/server/pages/index.js.nft.json)\r\n- [`no-sentry` .next/server/pages/api/hello.js.nft.json](https://github.com/hasharchives/sentry-vercel-nft-issue/blob/no-sentry/.next/server/pages/api/hello.js.nft.json)\r\n\r\n_Autogenerated `*.nft.json` files are one-liners. I ran `yarn dlx prettier --write .next/server/pages/**/*.nft.json` and then ordered file paths alphabetically to ease comparison._\r\n\r\nAs you can see, both files above refer `data.json` which is correct.\r\n\r\nInstalling `@sentry/nextjs@7.13.0` or `@sentry/nextjs@7.14.0` results in more items in `*.nft.json` but does not affect the presence of `data.json` – that’s good:\r\n\r\n- [`sentry-7.13` .next/server/pages/index.js.nft.json](https://github.com/hasharchives/sentry-vercel-nft-issue/blob/sentry-7.13/.next/server/pages/index.js.nft.json)\r\n- [`sentry-7.13` .next/server/pages/api/hello.js.nft.json](https://github.com/hasharchives/sentry-vercel-nft-issue/blob/sentry-7.13/.next/server/pages/api/hello.js.nft.json)\r\n- [`sentry-7.14` .next/server/pages/index.js.nft.json](https://github.com/hasharchives/sentry-vercel-nft-issue/blob/sentry-7.14/.next/server/pages/index.js.nft.json)\r\n- [`sentry-7.14` .next/server/pages/api/hello.js.nft.json](https://github.com/hasharchives/sentry-vercel-nft-issue/blob/sentry-7.14/.next/server/pages/api/hello.js.nft.json)\r\n\r\nHowever, switching to newer versions of `@sentry/nextjs` causes `data.json` to disappear:\r\n\r\n- [`sentry-7.15` .next/server/pages/index.js.nft.json](https://github.com/hasharchives/sentry-vercel-nft-issue/blob/sentry-7.15/.next/server/pages/index.js.nft.json)\r\n- [`sentry-7.15` .next/server/pages/api/hello.js.nft.json](https://github.com/hasharchives/sentry-vercel-nft-issue/blob/sentry-7.15/.next/server/pages/api/hello.js.nft.json)\r\n- [`sentry-7.16` .next/server/pages/index.js.nft.json](https://github.com/hasharchives/sentry-vercel-nft-issue/blob/sentry-7.16/.next/server/pages/index.js.nft.json)\r\n- [`sentry-7.16` .next/server/pages/api/hello.js.nft.json](https://github.com/hasharchives/sentry-vercel-nft-issue/blob/sentry-7.16/.next/server/pages/api/hello.js.nft.json)\r\n\r\nAlthough the result of `next build` works locally via `yarn start`, the Vercel deployment ends up corrupt because of the missing references. Lambda logs show this:\r\n\r\n```\r\n\r\nERROR\tError: /var/task/data.json: ENOENT: no such file or directory, open '/var/task/data.json'\r\n at Object.openSync (node:fs:585:3)\r\n at Object.readFileSync (node:fs:453:35)\r\n at Object.readFileSync (/var/task/node_modules/jsonfile/index.js:50:22)\r\n at Object.9791 (/var/task/.next/server/chunks/9791.js:70:49)\r\n at __webpack_require__ (/var/task/.next/server/webpack-runtime.js:25:42)\r\n at /var/task/.next/server/chunks/845.js:1566:78\r\n at Function.__webpack_require__.a (/var/task/.next/server/webpack-runtime.js:89:13)\r\n at Object.8841 (/var/task/.next/server/chunks/845.js:1548:21)\r\n at __webpack_require__ (/var/task/.next/server/webpack-runtime.js:25:42)\r\n at /var/task/.next/server/chunks/845.js:1508:89 {\r\n errno: -2,\r\n syscall: 'open',\r\n code: 'ENOENT',\r\n path: '/var/task/data.json'\r\n}\r\n2022-10-19T23:27:47.506Z\t173a20e7-ba14-4fa6-b23b-231c674bbf84\tERROR\tnull\r\nRequestId: 173a20e7-ba14-4fa6-b23b-231c674bbf84 Error: Runtime exited with error: exit status 1\r\nRuntime.ExitError\r\n```\r\n\r\n### Expected Result\r\n\r\n`data.json` is included in `*.nft.json` files for all tested `@sentry/nextjs` versions.\r\n\r\n### Actual Result\r\n\r\n`data.json` is included in `*.nft.json` files for `@sentry/nextjs@7.13.0` and `@sentry/nextjs@7.14.2`, but not for `@sentry/nextjs@7.15.0` and `@sentry/nextjs@7.16.0`. When the app is deployed to Vercel without `data.json` in `*.nft.json`, lambdas crash because the cannot open the file.\r\n\r\n### Links\r\n\r\n- [7.15 release notes](https://github.com/getsentry/sentry-javascript/releases/tag/7.15.0)\r\n- Possible regression source: https://github.com/getsentry/sentry-javascript/pull/5919","author":{"url":"https://github.com/kachkaev","@type":"Person","name":"kachkaev"},"datePublished":"2022-10-19T23:30:26Z","url":"https://github.com/getsentry/sentry-javascript/issues/5998"}
| 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:b0867070-f6f4-0ef3-ed77-202ff63119c7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D090:12691F:4093BA:56AB63:6B0438D5 |
| html-safe-nonce | fc92fc6ed1619e3c7ea2f9909a2dcd4e529b17b7f95fb1eea5bc9af2e5436606 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMDkwOjEyNjkxRjo0MDkzQkE6NTZBQjYzOjZCMDQzOEQ1IiwidmlzaXRvcl9pZCI6IjI0Mzg1OTUzMzA1Mjc0NzU5MjUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | cb8055a1bc5c7aa589683a1878ea1d69b302db53f75d61c72d12d77e134f88f1 |
| hovercard-subject-tag | issue:1415700932 |
| 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/5998/issue_layout |
| twitter:image | https://opengraph.githubassets.com/43ace4735a202678ede23676c19530fbf502abafb04dbdb185014bd3abd875f6/getsentry/sentry-javascript/issues/5998 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/43ace4735a202678ede23676c19530fbf502abafb04dbdb185014bd3abd875f6/getsentry/sentry-javascript/issues/5998 |
| 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 | kachkaev |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9185ccfefd80c1ff2d9ddcdb0cd2becf46b5a1efbbf30741a895e4bb8de25e64 |
| 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 | 06dc448a76fe4751ac1db26524aefa3aa3e889a8 |
| 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