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

Cloudflare deploy not working (Bundle > 1MiB) #77

Closed
Gyurmatag opened this issue Oct 8, 2024 · 7 comments
Closed

Cloudflare deploy not working (Bundle > 1MiB) #77

Gyurmatag opened this issue Oct 8, 2024 · 7 comments
Labels

Comments

@Gyurmatag
Copy link

Hello!

Whenever I want to deploy the app to Cloudflare this is the error that I get:

✘ [ERROR] A request to the Cloudflare API (/accounts/b8136ae2d8176456463716339d98a2ed/workers/scripts/my-open-next-app/versions) failed.

  Your Worker exceeded the size limit of 1 MiB. Refer to the Workers documentation (https://developers.cloudflare.com/workers/observability/errors/#errors-on-worker-upload) for more details. [code: 10027]

I have the create-cloudflare v2.29.2 version.

Please fix this problem!

@shashankboosi
Copy link
Contributor

Hello,

I have been recently getting my hands on different options to deploy and Cloudflare Workers was one of my options.

From what I see in their account plan limits with the free version your worker size cannot exceed 1 MB. So I guess you will have to upgrade to the Paid plan for your app to be deployed.

But 1 MB is a very small size given that most of the apps even after being gzipped will be more than that, would be good if it is increased.

@Gyurmatag
Copy link
Author

I don't want to pay, because the free plan is more than enough for me just to experience around. Will this be fixed?

@vicb vicb changed the title Cloudflare deploy not working Cloudflare deploy not working (Bundle > 1MiB) Oct 8, 2024
@shashankboosi
Copy link
Contributor

I feel the same, maybe 1 MB might have been enough for most server based starter apps but with Next.js after all the dependencies. It could go out of limit pretty soon. I hope they look into this limit.

@vicb
Copy link
Contributor

vicb commented Oct 8, 2024

We are aware of the size issue.

Our current priority is to add stabilize the cloudflare adapter and converge with other Open Next members.

We will look into optimizing the bundle size after that.

Feel free to investigate how to reduce the bundle size and send PR anytime!

@AaronTan11
Copy link

This was the whole output with the details of 5 largest dependencies.

> [email protected] deploy /Users/aarontan/Developer/my-next-app
> cloudflare && wrangler deploy

Building the Next.js app in the current folder (/Users/aarontan/Developer/my-next-app)
  ▲ Next.js 14.2.5

   Creating an optimized production build ...
 ✓ Compiled successfully
 ✓ Linting and checking validity of types
 ✓ Collecting page data
 ✓ Generating static pages (5/5)
 ✓ Collecting build traces
 ✓ Finalizing page optimization

Route (app)                              Size     First Load JS
┌ ○ /                                    5.25 kB        92.3 kB
└ ○ /_not-found                          871 B          87.9 kB
+ First Load JS shared by all            87 kB
  ├ chunks/23-b75664ace61c0abb.js        31.5 kB
  ├ chunks/fd9d1056-2821b0f0cabcd8bd.js  53.6 kB
  └ other shared chunks (total)          1.86 kB


○  (Static)  prerendered as static content

⚙️ Copying files...

# copyPrerenderedRoutes
# copyPackageTemplateFiles
⚙️ Bundling the worker file...

# patchWranglerDeps
# updateWebpackChunksFile
 - chunk 347.js
 - chunk 682.js
 - chunk 948.js
# patchRequire
# patchReadFile
# inlineNextRequire
# patchFindDir
# inlineEvalManifest
# patchCache
# inlineMiddlewareManifestRequire
# patchExceptionBubbling
Worker saved in `/Users/aarontan/Developer/my-next-app/.worker-next/index.mjs` 🚀


 ⛅️ wrangler 3.88.0
-------------------

🌀 Building list of assets...
🌀 Starting asset upload...
🌀 Found 30 new or modified static assets to upload. Proceeding with upload...
+ /_next/static/05FFM5wYYtfOstAx_4qJ3/_ssgManifest.js
+ /_next/static/05FFM5wYYtfOstAx_4qJ3/_buildManifest.js
+ /_next/static/chunks/pages/_app-6a626577ffa902a4.js
+ /vercel.svg
+ /_next/static/chunks/webpack-d0ceac4fb78a3613.js
+ /_next/static/media/97e0cb1ae144a2a9-s.woff2
+ /_next/static/css/36b7a5b0dc3c3f6e.css
+ /_next/static/media/55c55f0601d81cf3-s.woff2
+ /_next/static/media/6d93bde91c0c2823-s.woff2
+ /_next/static/chunks/23-b75664ace61c0abb.js
+ /cdn-cgi/_cf_seed_data/index.meta
+ /cdn-cgi/_cf_seed_data/favicon.ico.meta
+ /_next/static/chunks/app/layout-cd821c2e40fd4d86.js
+ /next.svg
+ /cdn-cgi/_cf_seed_data/index.rsc
+ /_next/static/chunks/173-32f9ff9bdfb525b3.js
+ /_next/static/media/26a46d62cd723877-s.woff2
+ /cdn-cgi/_cf_seed_data/favicon.ico.body
+ /_next/static/chunks/polyfills-78c92fac7aa8fdd8.js
+ /_next/static/chunks/framework-f66176bb897dc684.js
+ /_next/static/chunks/app/page-9ff629b8cf832d99.js
+ /_next/static/chunks/pages/_error-1be831200e60c5c0.js
+ /_next/static/chunks/main-app-f3339813dc86403f.js
+ /_next/static/chunks/app/_not-found/page-05886c10710171db.js
+ /_next/static/media/df0a9ae256c0569c-s.woff2
+ /cdn-cgi/_cf_seed_data/index.html
+ /_next/static/media/581909926a08bbc8-s.woff2
+ /_next/static/media/a34f9d1faa5f3315-s.p.woff2
+ /_next/static/chunks/main-c8553ba68b419844.js
+ /_next/static/chunks/fd9d1056-2821b0f0cabcd8bd.js
Uploaded 10 of 30 assets
Uploaded 20 of 30 assets
Uploaded 30 of 30 assets
✨ Success! Uploaded 30 files (4.07 sec)

Total Upload: 5165.74 KiB / gzip: 1341.85 KiB
▲ [WARNING] Here are the 5 largest dependencies included in your script:

  - node_modules/next/dist/compiled/node-fetch/index.js - 787.75 KiB
  - .worker-next/index.mjs - 685.51 KiB
  - node_modules/next/dist/compiled/terser/bundle.min.js - 477.70 KiB
  -
  .worker-next/.next/standalone/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js
  - 336.97 KiB
  - node_modules/next/dist/compiled/cssnano-simple/index.js - 231.70 KiB
  If these are unnecessary, consider removing them



✘ [ERROR] A request to the Cloudflare API (/accounts/df11b2baae35e6159c9590e45332dddc/workers/scripts/my-next-app) failed.

  Your Worker exceeded the size limit of 1 MiB. Refer to the Workers documentation
  (https://developers.cloudflare.com/workers/observability/errors/#errors-on-worker-upload) for more
  details. [code: 10027]

  If you think this is a bug, please open an issue at:
  https://github.com/cloudflare/workers-sdk/issues/new/choose


 ELIFECYCLE  Command failed with exit code 1.

 This is generated right after running the command:

npm create cloudflare@latest -- my-next-app --framework=next --experimental

meaning it's the one generated from the cli's template. I am just adding this here for references, in case anyone would like to open a PR or work with the team to solve this issue.

@Gyurmatag
Copy link
Author

Has someone worked on this? :) Would be great!

@emily-shen
Copy link

Hey, the limit for free tier is now 3MB, so this should work now 🎉
https://developers.cloudflare.com/workers/platform/limits/#account-plan-limits

@vicb vicb closed this as completed Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants