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

[🐛 Bug]: __PRERENDER_MANIFEST duplication #869

Open
1 task
Y90SMH opened this issue Aug 28, 2024 · 0 comments
Open
1 task

[🐛 Bug]: __PRERENDER_MANIFEST duplication #869

Y90SMH opened this issue Aug 28, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Y90SMH
Copy link

Y90SMH commented Aug 28, 2024

next-on-pages environment related information

System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:30 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6030
CPU: (11) arm64 Apple M3 Pro
Memory: 18 GB
Shell: /bin/zsh
Package Manager Used: npm (10.8.2)

Relevant Packages:
@cloudflare/next-on-pages: 1.13.2
vercel: 37.1.0
next: 14.2.5

Description

Observed behavior

Recently our team have been having issues moving more pages from SSR to static generation with our Next.js setup.
We have 1256 static pages at the moment and 24 edge function routes.
The static routes are all output to .next/prerender-manifest.json (this is normal Next.js behaviour).

npx wrangler pages deploy copies the contents of the prerender-manifest.json file into each edge function js file as a __PRERENDER_MANIFEST variable. This duplication pushes us over the 25MiB limit for an individual file.
Our prerender-manifest.json comes in at 781KiB, so for me we've got it duplicated 24 times and in theory only need 1 copy of this in the final _worker.js that's generated when executing npx wrangler pages deploy.

Has anyone else come across this before?
Is this intended behaviour or can the duplication be reduced?
Should I raise this instead or as well on https://github.com/cloudflare/workers-sdk?

Expected behavior

A shared __PRERENDER_MANIFEST variable in the final _workers.js

Reproduction

  1. Create a new Next.js app using the steps at Framework guides > Next.js > Full-stack (SSR) > Get started
  2. Add a new API route, e.g copy src/app/api/hello/route.ts to src/app/api/hi/route.ts
  3. npm run pages:build
  4. Inspect output in the following files, you'll see the duplication of a variable g.__PRERENDER_MANIFEST
  • .vercel/output/static/_worker.js/__next-on-pages-dist__/functions/api/hello.func.js
  • .vercel/output/static/_worker.js/__next-on-pages-dist__/functions/api/hi.func.js

Pages Deployment Method

Direct Upload (wrangler pages publish or the @cloudflare/pages-action GitHub Action)

Pages Deployment ID

No response

Additional Information

No response

Would you like to help?

  • Would you like to help fixing this bug?
@Y90SMH Y90SMH added the bug Something isn't working label Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant