René's URL Explorer Experiment


Title: Next.js v12 server side crashing on Vercel · Issue #4207 · getsentry/sentry-javascript · GitHub

Open Graph Title: Next.js v12 server side crashing on Vercel · Issue #4207 · getsentry/sentry-javascript

X Title: Next.js v12 server side crashing on Vercel · Issue #4207 · getsentry/sentry-javascript

Description: Related to #4103. The Next.js SDK crashes apps on the server-side when deployed on Vercel. It doesn't happen locally. Error logs 2021-12-01T13:01:48.296Z 31dc2972-71bb-4bcd-8ca1-d0d7502aa36c ERROR Error: Cannot find module '/var/task/nod...

Open Graph Description: Related to #4103. The Next.js SDK crashes apps on the server-side when deployed on Vercel. It doesn't happen locally. Error logs 2021-12-01T13:01:48.296Z 31dc2972-71bb-4bcd-8ca1-d0d7502aa36c ERROR ...

X Description: Related to #4103. The Next.js SDK crashes apps on the server-side when deployed on Vercel. It doesn't happen locally. Error logs 2021-12-01T13:01:48.296Z 31dc2972-71bb-4bcd-8ca1-d0d7502aa36c ER...

Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/4207

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.112.4


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Next.js v12 server side crashing on Vercel","articleBody":"Related to https://github.com/getsentry/sentry-javascript/issues/4103.\r\n\r\nThe Next.js SDK crashes apps on the server-side when deployed on Vercel. It doesn't happen locally.\r\n\r\n\u003cdetails>\r\n\u003csummary>Error logs\u003c/summary>\r\n\r\n```\r\n2021-12-01T13:01:48.296Z\t31dc2972-71bb-4bcd-8ca1-d0d7502aa36c\tERROR\tError: Cannot find module '/var/task/node_modules/next/dist/server/next.js'. Please verify that the package.json has a valid \"main\" entry\r\n    at tryPackage (internal/modules/cjs/loader.js:321:19)\r\n    at Function.Module._findPath (internal/modules/cjs/loader.js:534:18)\r\n    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:888:27)\r\n    at Function.Module._load (internal/modules/cjs/loader.js:746:27)\r\n    at Module.require (internal/modules/cjs/loader.js:974:19)\r\n    at require (internal/modules/cjs/helpers.js:93:18)\r\n    at Object.\u003canonymous> (/var/task/node_modules/@sentry/nextjs/dist/utils/instrumentServer.js:8:14)\r\n    at Module._compile (internal/modules/cjs/loader.js:1085:14)\r\n    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)\r\n    at Module.load (internal/modules/cjs/loader.js:950:32) {\r\n  code: 'MODULE_NOT_FOUND',\r\n  path: '/var/task/node_modules/next/package.json',\r\n  requestPath: 'next'\r\n}\r\nRequestId: 31dc2972-71bb-4bcd-8ca1-d0d7502aa36c Error: Runtime exited with error: exit status 1\r\nRuntime.ExitError\r\n```\r\n\r\n\u003c/details>\r\n\r\n### Cause\r\n\r\nThis error is caused by importing modules from `next`. In the SDK, this import is required to instrument the server, see https://github.com/getsentry/sentry-javascript/blob/a6c384c935f9cd9ea7c9b5442537e08e3f13d1b7/packages/nextjs/src/utils/instrumentServer.ts#L14\r\n\r\nand the server instrumentation is run when initializing the SDK on the server side, see https://github.com/getsentry/sentry-javascript/blob/a6c384c935f9cd9ea7c9b5442537e08e3f13d1b7/packages/nextjs/src/index.server.ts#L122-L123\r\n\r\n### Solution\r\n\r\nOn Vercel, the server instrumentation has no effect. Errors and transactions are captured through the [custom `_error.js` page](https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#create-a-custom-_error-page) and the [`withSentry` handler](https://docs.sentry.io/platforms/javascript/guides/nextjs/#configure). Not instrumenting the server (to not import any modules from `next`) when an app is deployed on Vercel should fix the issue, and the [`VERCEL` environment variable](https://vercel.com/docs/concepts/projects/environment-variables#system-environment-variables) can be helpful here, as used in https://github.com/getsentry/sentry-javascript/blob/a6c384c935f9cd9ea7c9b5442537e08e3f13d1b7/packages/nextjs/src/index.server.ts#L57\r\n\r\nTechnical details may be more complex, to be defined.","author":{"url":"https://github.com/iker-barriocanal","@type":"Person","name":"iker-barriocanal"},"datePublished":"2021-12-01T13:22:45Z","url":"https://github.com/getsentry/sentry-javascript/issues/4207"}

react-profiling0
react-import-mapreact,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-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:9caccdbf-bb4a-b76e-5cdf-785a114c613a
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8B9A:27DDD:8EB9F:C1C85:6B0446AB
html-safe-nonce152219a2ead03b1a98b0213d876a11088ab19fef82c38abfbf3e547cb07ee80b
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QjlBOjI3REREOjhFQjlGOkMxQzg1OjZCMDQ0NkFCIiwidmlzaXRvcl9pZCI6IjQ5NDIwMDg3ODUyNzIzMjU4MDMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacebf505cb45263fbcace776dd7bb51123ccb9e671869165780e62bbcfb12029af
hovercard-subject-tagissue:1068402951
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/4207/issue_layout
twitter:imagehttps://opengraph.githubassets.com/c678148b6cfa3feb61ecdb64953a051120426f5e9055c8b790a6624d21007e33/getsentry/sentry-javascript/issues/4207
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/c678148b6cfa3feb61ecdb64953a051120426f5e9055c8b790a6624d21007e33/getsentry/sentry-javascript/issues/4207
og:image:altRelated to #4103. The Next.js SDK crashes apps on the server-side when deployed on Vercel. It doesn't happen locally. Error logs 2021-12-01T13:01:48.296Z 31dc2972-71bb-4bcd-8ca1-d0d7502aa36c ERROR ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameiker-barriocanal
hostnamegithub.com
expected-hostnamegithub.com
Noned4495c3631faba668036f176d1f5946901c5172efd73a6edb984029e7d4f8e46
turbo-cache-controlno-preview
go-importgithub.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git
octolytics-dimension-user_id1396951
octolytics-dimension-user_logingetsentry
octolytics-dimension-repository_id3328572
octolytics-dimension-repository_nwogetsentry/sentry-javascript
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id3328572
octolytics-dimension-repository_network_root_nwogetsentry/sentry-javascript
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release9ac4337fb7c6a5846cdfdb1a04f154d3c33ebc77
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/getsentry/sentry-javascript/issues/4207#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-javascript%2Fissues%2F4207
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-javascript%2Fissues%2F4207
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=getsentry%2Fsentry-javascript
Reloadhttps://github.com/getsentry/sentry-javascript/issues/4207
Reloadhttps://github.com/getsentry/sentry-javascript/issues/4207
Reloadhttps://github.com/getsentry/sentry-javascript/issues/4207
getsentryhttps://github.com/getsentry
sentry-javascripthttps://github.com/getsentry/sentry-javascript
Codehttps://github.com/getsentry/sentry-javascript
Issues339 (339)https://github.com/getsentry/sentry-javascript/issues
Pull requests53 (53)https://github.com/getsentry/sentry-javascript/pulls
Discussionshttps://github.com/getsentry/sentry-javascript/discussions
Actionshttps://github.com/getsentry/sentry-javascript/actions
Security and quality7 (7)https://github.com/getsentry/sentry-javascript/security
Insightshttps://github.com/getsentry/sentry-javascript/insights
https://github.com/getsentry/sentry-javascript
New issuehttps://github.com/login?return_to=https://github.com/getsentry/sentry-javascript/issues/4207
New issuehttps://github.com/login?return_to=https://github.com/getsentry/sentry-javascript/issues/4207
#4255https://github.com/getsentry/sentry-javascript/pull/4255
Next.js v12 server side crashing on Vercelhttps://github.com/getsentry/sentry-javascript/issues/4207#top
#4255https://github.com/getsentry/sentry-javascript/pull/4255
Meta: Breakinghttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Meta%3A%20Breaking%22
Next.js 12 Supporthttps://github.com/getsentry/sentry-javascript/milestone/9
https://github.com/iker-barriocanal
iker-barriocanalhttps://github.com/iker-barriocanal
on Dec 1, 2021https://github.com/getsentry/sentry-javascript/issues/4207#issue-1068402951
#4103https://github.com/getsentry/sentry-javascript/issues/4103
sentry-javascript/packages/nextjs/src/utils/instrumentServer.tshttps://github.com/getsentry/sentry-javascript/blob/a6c384c935f9cd9ea7c9b5442537e08e3f13d1b7/packages/nextjs/src/utils/instrumentServer.ts#L14
a6c384chttps://github.com/getsentry/sentry-javascript/commit/a6c384c935f9cd9ea7c9b5442537e08e3f13d1b7
sentry-javascript/packages/nextjs/src/index.server.tshttps://github.com/getsentry/sentry-javascript/blob/a6c384c935f9cd9ea7c9b5442537e08e3f13d1b7/packages/nextjs/src/index.server.ts#L122-L123
a6c384chttps://github.com/getsentry/sentry-javascript/commit/a6c384c935f9cd9ea7c9b5442537e08e3f13d1b7
custom _error.js pagehttps://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#create-a-custom-_error-page
withSentry handlerhttps://docs.sentry.io/platforms/javascript/guides/nextjs/#configure
VERCEL environment variablehttps://vercel.com/docs/concepts/projects/environment-variables#system-environment-variables
sentry-javascript/packages/nextjs/src/index.server.tshttps://github.com/getsentry/sentry-javascript/blob/a6c384c935f9cd9ea7c9b5442537e08e3f13d1b7/packages/nextjs/src/index.server.ts#L57
a6c384chttps://github.com/getsentry/sentry-javascript/commit/a6c384c935f9cd9ea7c9b5442537e08e3f13d1b7
iker-barriocanalhttps://github.com/iker-barriocanal
Meta: Breakinghttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Meta%3A%20Breaking%22
Package: nextjshttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Package%3A%20nextjs%22
on Dec 1, 2021https://github.com/getsentry/sentry-javascript/issues/4207#event-5698979103
iker-barriocanalhttps://github.com/iker-barriocanal
Next.js 12 Supporthttps://github.com/getsentry/sentry-javascript/milestone/9
on Dec 1, 2021https://github.com/getsentry/sentry-javascript/issues/4207#event-5698979125
AbhiPrasadhttps://github.com/AbhiPrasad
Status: Backloghttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Status%3A%20Backlog%22
on Dec 1, 2021https://github.com/getsentry/sentry-javascript/issues/4207#event-5699167131
https://github.com/rocketman-w
rocketman-whttps://github.com/rocketman-w
on Dec 3, 2021https://github.com/getsentry/sentry-javascript/issues/4207#issuecomment-985779014
https://github.com/boennemann
boennemannhttps://github.com/boennemann
on Dec 7, 2021https://github.com/getsentry/sentry-javascript/issues/4207#issuecomment-988224827
https://github.com/smeubank
smeubankhttps://github.com/smeubank
on Dec 9, 2021https://github.com/getsentry/sentry-javascript/issues/4207#issuecomment-990151899
@boennemannhttps://github.com/boennemann
https://github.com/getsentry/sentry-javascript/tree/kmclb-nextjs-no-instrumentserver-on-vercelhttps://github.com/getsentry/sentry-javascript/tree/kmclb-nextjs-no-instrumentserver-on-vercel
iker-barriocanalhttps://github.com/iker-barriocanal
completedhttps://github.com/getsentry/sentry-javascript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#4255https://github.com/getsentry/sentry-javascript/pull/4255
on Dec 10, 2021https://github.com/getsentry/sentry-javascript/issues/4207#event-5747635091
https://github.com/boennemann
boennemannhttps://github.com/boennemann
on Dec 10, 2021https://github.com/getsentry/sentry-javascript/issues/4207#issuecomment-990962709
@smeubankhttps://github.com/smeubank
https://github.com/iker-barriocanal
iker-barriocanalhttps://github.com/iker-barriocanal
on Dec 10, 2021https://github.com/getsentry/sentry-javascript/issues/4207#issuecomment-991032704
https://github.com/swudged
swudgedhttps://github.com/swudged
on Dec 11, 2021https://github.com/getsentry/sentry-javascript/issues/4207#issuecomment-991588184
@iker-barriocanalhttps://github.com/iker-barriocanal
#4103https://github.com/getsentry/sentry-javascript/issues/4103
https://github.com/iker-barriocanal
iker-barriocanalhttps://github.com/iker-barriocanal
on Dec 13, 2021https://github.com/getsentry/sentry-javascript/issues/4207#issuecomment-992430812
@swudgedhttps://github.com/swudged
https://github.com/shinnoki
shinnokihttps://github.com/shinnoki
on Dec 15, 2021https://github.com/getsentry/sentry-javascript/issues/4207#issuecomment-994163293
https://vercel.com/docs/concepts/projects/environment-variables#system-environment-variableshttps://vercel.com/docs/concepts/projects/environment-variables#system-environment-variables
https://github.com/iker-barriocanal
iker-barriocanalhttps://github.com/iker-barriocanal
on Dec 15, 2021https://github.com/getsentry/sentry-javascript/issues/4207#issuecomment-994934873
@shinnokihttps://github.com/shinnoki
@swudgedhttps://github.com/swudged
https://github.com/swudged
swudgedhttps://github.com/swudged
on Dec 15, 2021https://github.com/getsentry/sentry-javascript/issues/4207#issuecomment-994947947
@iker-barriocanalhttps://github.com/iker-barriocanal
https://github.com/curiousercreative
curiousercreativehttps://github.com/curiousercreative
on Dec 15, 2021https://github.com/getsentry/sentry-javascript/issues/4207#issuecomment-995111546
@iker-barriocanalhttps://github.com/iker-barriocanal
https://github.com/iker-barriocanal
iker-barriocanalhttps://github.com/iker-barriocanal
on Dec 17, 2021https://github.com/getsentry/sentry-javascript/issues/4207#issuecomment-996849998
@curiousercreativehttps://github.com/curiousercreative
https://github.com/curiousercreative
curiousercreativehttps://github.com/curiousercreative
on Dec 17, 2021https://github.com/getsentry/sentry-javascript/issues/4207#issuecomment-996893532
@iker-barriocanalhttps://github.com/iker-barriocanal
Sign up for freehttps://github.com/signup?return_to=https://github.com/getsentry/sentry-javascript/issues/4207
Sign in to commenthttps://github.com/login?return_to=https://github.com/getsentry/sentry-javascript/issues/4207
Meta: Breakinghttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Meta%3A%20Breaking%22
Next.js 12 Supporthttps://github.com/getsentry/sentry-javascript/milestone/9
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.