Skip to content

Build error on Vercel deployments after upgrading to 13.4 #49261

@laubonghaudoi

Description

@laubonghaudoi

Verify canary release

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

Provide environment information

Operating System:
      Platform: darwin
      Arch: x64
      Version: Darwin Kernel Version 22.4.0: Mon Mar  6 21:00:17 PST 2023; root:xnu-8796.101.5~3/RELEASE_X86_64
    Binaries:
      Node: 16.13.2
      npm: 9.6.4
      Yarn: 3.4.1
      pnpm: 7.21.0
    Relevant packages:
      next: 13.4.0
      eslint-config-next: 13.4.0
      react: 18.2.0
      react-dom: 18.2.0

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

No response

Link to the code that reproduces this issue

none

To Reproduce

Upgrade next from ^13.3.4 tp ^13.4.0. The project is using pages/, not using app/dir nor turbopack.

Describe the Bug

I just updated the nextJS version from 13.3 to 13.4 without change anything in my codebase. The local build is successful without any errors, but when deployed on Vercel, I got hundreds of lines of error like

Error occurred prerendering page "/en/post/100". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: Cannot read properties of null (reading 'useEffect')
    at exports.useEffect (/vercel/path0/node_modules/react/cjs/react.production.min.js:24:292)
    at Analytics (file:///vercel/path0/node_modules/@vercel/analytics/dist/react/index.js:132:3)
    at Ge (/vercel/path0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:114:273)
    at Z (/vercel/path0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:120:91)
    at He (/vercel/path0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:123:155)
    at Je (/vercel/path0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:122:100)
    at Z (/vercel/path0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:120:222)
    at Ge (/vercel/path0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:119:95)
    at Z (/vercel/path0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:120:91)
    at Ge (/vercel/path0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:115:9)

I speculate that this is caused by my components not being specified as client components. But I am not using the app/ directory, I am only using the /pages. Does that mean I need to specify client components even if I am using /pages? I tried adding 'use client' to the top of my component files and the error still persists.

The local builds are successful without any errors, this only happens on Vercel deployments.

Expected Behavior

Build should be successful with no error.

Which browser are you using? (if relevant)

irrelevant

How are you deploying your application? (if relevant)

Vercel

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue was opened via the bug report template.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions