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

Enabling PPR causes HTTP 500 when scanned by bots #60620

Closed
1 task done
mwskwong opened this issue Jan 14, 2024 · 19 comments
Closed
1 task done

Enabling PPR causes HTTP 500 when scanned by bots #60620

mwskwong opened this issue Jan 14, 2024 · 19 comments
Labels
bug Issue was opened via the bug report template. locked Partial Prerendering (PPR) Related to Partial Prerendering.

Comments

@mwskwong
Copy link

mwskwong commented Jan 14, 2024

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

@mwskwong mwskwong added the bug Issue was opened via the bug report template. label Jan 14, 2024
@mwskwong
Copy link
Author

Update:
Reddit, Discord, WhatsApp don't seem to be affected by this.

@libhide
Copy link

libhide commented Jan 19, 2024

I'm seeing this too. WhatsApp seems to be a problem for me. Twitter, Reddit, iMessage work. LinkedIn, WhatsApp not working. I opened a discussion regarding this too here before I saw this issue.

Is there a fix that can be done for this?

@mwskwong
Copy link
Author

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

@libhide
Copy link

libhide commented Jan 29, 2024

@leerob 👀

@leerob
Copy link
Member

leerob commented Jan 30, 2024

I am not seeing an issue rendering social cards as mentioned for leerob.io.

Slack

CleanShot 2024-01-29 at 21 06 59@2x

LinkedIn

CleanShot 2024-01-29 at 21 07 59@2x

@mwskwong
Copy link
Author

mwskwong commented Jan 30, 2024

I am not seeing an issue rendering social cards as mentioned for leerob.io.

Slack
LinkedIn

Interesting, on LinkedIn, sharing home page for real is fine, but Post Inspector complaints.

https://www.linkedin.com/post-inspector/inspect/https:%2F%2Fleerob.io

Yet, for blog pages, which uses PPR for real, the issue is reproducible.

Screenshot_2024-01-30-11-31-03-040_com linkedin android-edit

Edit: Thinking of that, @leerob, the current behavior you experienced in LinkedIn may be due to LinkedIn caching the metadata. You may try to share the auto-generated deployment URL to verify that.

@libhide
Copy link

libhide commented Jan 30, 2024

I too have noticed that the previews work for the website itself (ratik.in in my case) but fail to work for the blog or any of the nested pages.

@mwskwong
Copy link
Author

mwskwong commented Feb 6, 2024

Updated the OP

  1. Updated next to the latest canary version
  2. Added a branch that literally just removes the ppr flag, and the issue is not reproducible on it.

@mwskwong
Copy link
Author

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'
}

@mwskwong
Copy link
Author

Oh, adding www.partialprerendering.com as the reproduction.

https://www.linkedin.com/post-inspector/inspect/https:%2F%2Fwww.partialprerendering.com%2F

@libhide
Copy link

libhide commented Apr 24, 2024

@mwskwong Any luck with fixing this? Seems to still be an issue :/

@mwskwong
Copy link
Author

@mwskwong Any luck with fixing this? Seems to still be an issue :/

Nope. I don't think there is anything I can do from the user side, besides not using PPR.

@libhide
Copy link

libhide commented Apr 25, 2024

@mwskwong Any luck with fixing this? Seems to still be an issue :/

Nope. I don't think there is anything I can do from the user side, besides not using PPR.

Yeah, same.

@leerob Any chance you'd know what's up with this issue?

@leerob leerob added the Partial Prerendering (PPR) Related to Partial Prerendering. label Apr 26, 2024
@leerob
Copy link
Member

leerob commented Apr 26, 2024

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.

@wyattjoh
Copy link
Member

Give the latest canary a shot, the issues you've experienced are likely to have been fixed recently.

@mwskwong
Copy link
Author

Give the latest canary a shot, the issues you've experienced are likely to have been fixed recently.

No, it doesn't. I updated the reproduction's dependencies and deployed it accordingly

Also, the behavior can be easily verified by just toggling the ppr flag.

@wyattjoh
Copy link
Member

wyattjoh commented Jul 2, 2024

Thanks for the details @mwskwong, I was able to identify and resolve the issue on Vercel's end. Let us know if the problem re-occurs by opening a new issue!

@libhide
Copy link

libhide commented Jul 2, 2024

Can confirm that this is fixed for me too. Thanks, everyone involved!

Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for 2 weeks. 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 17, 2024
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 Partial Prerendering (PPR) Related to Partial Prerendering.
Projects
None yet
Development

No branches or pull requests

4 participants