next.js: Enabling PPR causes HTTP 500 when scanned by bots

Link to the code that reproduces this issue

https://github.com/mwskwong/http-500-when-visit-by-bot

  • main branch: PPR enabled
  • feature/without-ppr branch: removed the ppr flag

To Reproduce

  1. Bootstrap a Next.js app with the CLI
  2. Enable PPR in the config file

Deployments

Current vs. Expected behavior

Current The app will throw a 500 error when it is scanned by some social media bots, typically when sharing the link of the website on social media. Reproduced on LinkedIn, Twitter, and Facebook (also with their share debuggers respectively).

It seems that it’s a hydration error, but I’m not sure why it shows up on the server log.

image

Expected It should not throw an error when the site is scanned by a bot.

Verify canary release

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

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Home
Binaries:
  Node: 20.9.0
  npm: N/A
  Yarn: N/A
  pnpm: 8.14.1
Relevant Packages:
  next: 14.0.5-canary.56
  eslint-config-next: 14.0.5-canary.56
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.3.3
Next.js Config:
  output: N/A

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

App Router

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

Vercel (Deployed), Other (Deployed)

Additional context

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 19 (5 by maintainers)

Most upvoted comments

As a reminder, PPR is still experimental. We are currently triaging and investigating other, higher requested bugs/features right now, but thank you for providing more details on this issue.

Vercel seems to finally be able to show the full log, so here is one example of it.

Error: Expected the resume to render <j> in this slot but instead it rendered <A>. The tree doesn't match so React will fallback to client rendering.
    at nq (/var/task/node_modules/next/dist/compiled/next-server/app-page-experimental.runtime.prod.js:12:66996)
    at nJ (/var/task/node_modules/next/dist/compiled/next-server/app-page-experimental.runtime.prod.js:12:73075)
    at nz (/var/task/node_modules/next/dist/compiled/next-server/app-page-experimental.runtime.prod.js:12:71240)
    at nq (/var/task/node_modules/next/dist/compiled/next-server/app-page-experimental.runtime.prod.js:12:69426)
    at nJ (/var/task/node_modules/next/dist/compiled/next-server/app-page-experimental.runtime.prod.js:12:73075)
    at nU (/var/task/node_modules/next/dist/compiled/next-server/app-page-experimental.runtime.prod.js:12:51918)
    at nq (/var/task/node_modules/next/dist/compiled/next-server/app-page-experimental.runtime.prod.js:12:67235)
    at nJ (/var/task/node_modules/next/dist/compiled/next-server/app-page-experimental.runtime.prod.js:12:73075)
    at nU (/var/task/node_modules/next/dist/compiled/next-server/app-page-experimental.runtime.prod.js:12:51918)
    at nq (/var/task/node_modules/next/dist/compiled/next-server/app-page-experimental.runtime.prod.js:12:67235) {
  digest: '1647279640'
}

As a side note: Leerob’s site, which is also using PPR, suffers from the same issue.