Skip to content

Hydration error caused by returning a promise as children from a server component #56470

@tom-sherman

Description

@tom-sherman

Link to the code that reproduces this issue

https://github.com/tom-sherman/next-promise-as-child-bug

To Reproduce

  1. next dev
  2. Load the page

Current vs. Expected behavior

Current:

A React error is thrown

Uncaught Error: Hydration failed because the initial UI does not match what was rendered on the server.
...
Warning: An error occurred during hydration. The server HTML was replaced with client content in <#document>.
...
Uncaught TypeError: Cannot read properties of null (reading 'nodeName')
    at warnForInsertedHydratedElement (webpack-internal:///(:3000/app-pages-browse

Expected:

As far as I'm aware this is a supported pattern in React canary, but if that's not the case or this is not implemented yet I'd expect a more clear and specific error message from Next.js.

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.6.0: Wed Jul  5 22:22:05 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T6000
Binaries:
  Node: 18.13.0
  npm: 8.13.2
  Yarn: 1.22.19
  pnpm: 8.6.6
Relevant Packages:
  next: 13.5.5-canary.2
  eslint-config-next: N/A
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.1.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

App Router

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue was opened via the bug report template.locked

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions