Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Next.js 13.4 build errors #4316

Closed
1 task
JoeKarow opened this issue May 4, 2023 · 2 comments
Closed
1 task

bug: Next.js 13.4 build errors #4316

JoeKarow opened this issue May 4, 2023 · 2 comments

Comments

@JoeKarow
Copy link

JoeKarow commented May 4, 2023

Provide environment information

  System:
    OS: macOS 13.3.1
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 216.73 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.16.0 - ~/Library/Caches/fnm_multishells/7767_1683126064680/bin/node
    Yarn: 1.22.19 - ~/Library/pnpm/yarn
    npm: 9.5.1 - ~/Library/Caches/fnm_multishells/7767_1683126064680/bin/npm
  Browsers:
    Brave Browser: 107.1.45.127
    Chrome: 109.0.5414.119
    Firefox: 106.0
    Safari: 16.4
  npmPackages:
    @tanstack/react-query: 4.29.5 => 4.29.5
    @trpc/client: 10.25.0 => 10.25.0
    @trpc/next: 10.25.0 => 10.25.0
    @trpc/react-query: 10.25.0 => 10.25.0
    @trpc/server: 10.25.0 => 10.25.0
    next: 13.4.0 => 13.4.0
    react: 18.2.0 => 18.2.0
    typescript: 5.0.4 => 5.0.4

Describe the bug

Upgrading Next.js to 13.4 causes the project to not build.
The following error was repeated for several different routes:

Build Error (single example)
Error occurred prerendering page "/profile". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: Cannot read properties of null (reading 'useMemo')
    at exports.useMemo (/Users/joe/GitHub/InReach/monorepo/node_modules/.pnpm/react@18.2.0/node_modules/react/cjs/react.production.min.js:25:208)
    at Object.useDehydratedState (file:///Users/joe/GitHub/InReach/monorepo/node_modules/.pnpm/@trpc+react-query@10.25.0_@tanstack+react-query@4.29.5_@trpc+client@10.25.0_@trpc+server@10.2_g6kbjzangqetmhsdt26x4s6jva/node_modules/@trpc/react-query/dist/createHooksInternal-ac3d45d9.mjs:517:29)
    at WithTRPC (/Users/joe/GitHub/InReach/monorepo/apps/app/.next/server/chunks/248.js:13429:38)
    at Ge (/Users/joe/GitHub/InReach/monorepo/node_modules/.pnpm/next@13.4.0_@opentelemetry+api@1.4.1_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:114:273)
    at Z (/Users/joe/GitHub/InReach/monorepo/node_modules/.pnpm/next@13.4.0_@opentelemetry+api@1.4.1_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:120:91)
    at Ge (/Users/joe/GitHub/InReach/monorepo/node_modules/.pnpm/next@13.4.0_@opentelemetry+api@1.4.1_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:115:9)
    at Z (/Users/joe/GitHub/InReach/monorepo/node_modules/.pnpm/next@13.4.0_@opentelemetry+api@1.4.1_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:120:91)
    at He (/Users/joe/GitHub/InReach/monorepo/node_modules/.pnpm/next@13.4.0_@opentelemetry+api@1.4.1_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:123:155)
    at Je (/Users/joe/GitHub/InReach/monorepo/node_modules/.pnpm/next@13.4.0_@opentelemetry+api@1.4.1_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:122:100)
    at Z (/Users/joe/GitHub/InReach/monorepo/node_modules/.pnpm/next@13.4.0_@opentelemetry+api@1.4.1_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:120:222)

Summary of route errors:

> Export encountered errors on following paths:
	/_error: /404
	/_error: /500
	/_error: /ar/404
	/_error: /ar/500
	/_error: /en/404
	/_error: /en/500
	/_error: /es/404
	/_error: /es/500
	/_error: /fr/404
	/_error: /fr/500
	/_error: /ru/404
	/_error: /ru/500
	/profile
	/profile: /ar/profile
	/profile: /en/profile
	/profile: /es/profile
	/profile: /fr/profile
	/profile: /ru/profile
	/search
	/search: /ar/search
	/search: /en/search
	/search: /es/search
	/search: /fr/search
	/search: /ru/search

Removing the withTRPC wrapper in _app.tsx allows the build to succeed.

Link to reproduction

https://github.com/weareinreach/InReach/tree/renovate/next.js

To reproduce

Run pnpm build from the apps/app directory in the monorepo.

Additional information

No response

👨‍👧‍👦 Contributing

  • 🙋‍♂️ Yes, I'd be down to file a PR fixing this bug!
@KATT
Copy link
Member

KATT commented May 5, 2023

My hunch is that we need to output "use client" in the build

@michalbundyra
Copy link

@KATT with NextJS 13.4.1 it works fine again, probably fixed in vercel/next.js#49274

@KATT KATT closed this as completed May 5, 2023
yeicobF added a commit to yeicobF/crAIte that referenced this issue May 7, 2023
If I don't add the chevron, the deployment fails.

- trpc/trpc#4316
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants