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

React is null in vercel production build #49753

Closed
1 task done
jeetiss opened this issue May 13, 2023 · 11 comments · Fixed by #49954
Closed
1 task done

React is null in vercel production build #49753

jeetiss opened this issue May 13, 2023 · 11 comments · Fixed by #49954
Assignees
Labels
bug Issue was opened via the bug report template. locked

Comments

@jeetiss
Copy link

jeetiss commented May 13, 2023

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: darwin
      Arch: arm64
      Version: Darwin Kernel Version 22.3.0: Mon Jan 30 20:38:37 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6000
    Binaries:
      Node: 18.12.0
      npm: 8.19.3
      Yarn: 1.22.17
      pnpm: 7.29.1
    Relevant packages:
      next: 13.4.3-canary.0
      eslint-config-next: N/A
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 5.0.4

Which area(s) of Next.js are affected? (leave empty if unsure)

No response

Link to the code that reproduces this issue

https://github.com/jeetiss/next-react-is-null

To Reproduce

  • deploy to vercel
  • build will fail with error
17:08:21.113 | TypeError: Cannot read properties of null (reading 'useEffect')
17:08:21.113 | at exports.useEffect (/vercel/path0/node_modules/react/cjs/react.production.min.js:24:292)
17:08:21.113 | at QueryClientProvider (file:///vercel/path0/node_modules/@tanstack/react-query/build/lib/QueryClientProvider.mjs:46:9)
17:08:21.113 | at Ge (/vercel/path0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:114:273)
17:08:21.114 | at Z (/vercel/path0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:120:91)
17:08:21.114 | at Ge (/vercel/path0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:119:95)
17:08:21.114 | at Z (/vercel/path0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:120:91)
17:08:21.114 | at Ge (/vercel/path0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:115:9)
17:08:21.115 | at Z (/vercel/path0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:120:91)
17:08:21.115 | at Ge (/vercel/path0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:115:9)
17:08:21.115 | at Z (/vercel/path0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:120:91)
17:08:21.117 |  
17:08:21.118 | Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
17:08:21.118 | TypeError: Cannot read properties of null (reading 'useEffect')
17:08:21.118 | at exports.useEffect (/vercel/path0/node_modules/react/cjs/react.production.min.js:24:292)
17:08:21.118 | at QueryClientProvider (file:///vercel/path0/node_modules/@tanstack/react-query/build/lib/QueryClientProvider.mjs:46:9)
17:08:21.118 | at Ge (/vercel/path0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:114:273)
17:08:21.120 | at Z (/vercel/path0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:120:91)
17:08:21.124 | at Ge (/vercel/path0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:119:95)
17:08:21.124 | at Z (/vercel/path0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:120:91)
17:08:21.124 | at Ge (/vercel/path0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:115:9)
17:08:21.125 | at Z (/vercel/path0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:120:91)
17:08:21.125 | at Ge (/vercel/path0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:115:9)
17:08:21.125 | at Z (/vercel/path0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:120:91)



Describe the Bug

deploy to vercel doesn't work when both app and pages directories are exist

Expected Behavior

deploy should work

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

Vercel

@jeetiss jeetiss added the bug Issue was opened via the bug report template. label May 13, 2023
@jeetiss
Copy link
Author

jeetiss commented May 13, 2023

сс @shuding seems like Cannot read properties of null bug affects deployment to vercel too

v13.3.4 works, but all releases after is not

@laubonghaudoi
Copy link

laubonghaudoi commented May 14, 2023

This seems to be related to #49261 (comment)
Are you using a dynamic component too? It is not caused by having both pages/ and app/, having pages/ only causes error as well.

@jeetiss
Copy link
Author

jeetiss commented May 15, 2023

Nope, I don't use dynamic imports.

And my demo works when i remove the app folder
jeetiss/next-react-is-null#1

@shuding shuding self-assigned this May 16, 2023
ijjk added a commit that referenced this issue May 18, 2023
This removes the previous handling for the prebundled react env we were
setting in favor of vercel/vercel#9974

We need to wait to land this until
vercel/vercel#9974 has been rolled

Fixes: #49169
Fixes: #49753
x-ref: #48948
@ijjk
Copy link
Member

ijjk commented May 19, 2023

Hi, this has been updated in v13.4.3, please update and give it a try!

@jeetiss
Copy link
Author

jeetiss commented May 19, 2023

Thanks, it works ❤️‍🔥

hydRAnger pushed a commit to hydRAnger/next.js that referenced this issue Jun 12, 2023
This removes the previous handling for the prebundled react env we were
setting in favor of vercel/vercel#9974

We need to wait to land this until
vercel/vercel#9974 has been rolled

Fixes: vercel#49169
Fixes: vercel#49753
x-ref: vercel#48948
@Hanggi
Copy link

Hanggi commented Jun 17, 2023

I have same issue in Next v13.4.6

@huozhi
Copy link
Member

huozhi commented Jun 17, 2023

@Hanggi please file a new issue with your reproduction, thanks

@quocthangit247
Copy link

I have same issue in Next v13.4.6

same issue but I downgraded it to v13.4.3, it works like a charm

@Linkmetal
Copy link

Same here, downgraded it to v13.4.3 and works fine in Firebase Hosting

@chrisneven
Copy link
Contributor

We've noticed this issue as well. It also broke our revalidation implementation

Can confirm downgrading to v13.4.3 resolves the issue

@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. locked
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants