wevm / frog

Framework for Farcaster Frames 🐸
https://frog.fm
Other
423 stars 97 forks source link

Wrangler Deploy Fails After Adding FrogUI #240

Closed earth2travis closed 5 months ago

earth2travis commented 7 months ago

Describe the bug

Receiving Cloudflare error workers.api.error.script_too_large [code: 10027] after adding FrogUI

Link to Minimal Reproducible Example

TypeScript Playground

Steps To Reproduce

Trying to get 🐸 working with Cloudflare Workers

pnpm create frog -t cloudflare-worker

In index.tsx changed:

const manifest = await import('__STATIC_CONTENT_MANIFEST')
const serveStaticOptions = { manifest, root: './' }

to:

const serveStaticOptions = { root: './', manifest: {} };

Added the top level main field to workers.toml:

main = "workers-site/index.js"
pnpm wrangler deploy --minify src/index.tsx

And it successfully deployed:

Total Upload: 2334.26 KiB / gzip: 831.76 KiB

Then I added ui.tsx, imported it, and added some styles in index.tsx

import { Box, Heading, VStack, vars } from './ui.js';

Attempted to deploy the updates:

pnpm wrangler deploy --minify src/index.tsx

And it is failing with the following:

▲ [WARNING] We recommend keeping your script less than 1MiB (1024 KiB) after gzip. Exceeding this can affect cold start time. Consider using Wrangler's `--minify` option to reduce your bundle size.

▲ [WARNING] Here are the 5 largest dependencies included in your script:

- node_modules/.pnpm/frog@0.8.1_hono@4.2.3/node_modules/frog/_lib/ui/icons.js - 1841.18 KiB
- node_modules/.pnpm/workers-og@0.0.24/node_modules/workers-og/dist/resvg-LFIOYO65.wasm - 1341.69 KiB
- node_modules/.pnpm/workers-og@0.0.24/node_modules/workers-og/dist/index.js - 400.18 KiB
- node_modules/.pnpm/workers-og@0.0.24/node_modules/workers-og/dist/yoga-ZMNYPE6Z.wasm - 86.58 KiB
- node_modules/.pnpm/@scure+bip39@1.2.1/node_modules/@scure/bip39/esm/wordlists/korean.js - 71.91 KiB

If these are unnecessary, consider removing them

✘ [ERROR] A request to the Cloudflare API (/accounts/4e1a03d9fee3ff0defb22eb9feb2c42e/workers/scripts/frog-template) failed.

workers.api.error.script_too_large [code: 10027]
Total Upload: 4185.50 KiB / gzip: 1082.08 KiB

Frog Version

0.8.1

TypeScript Version

5.4.5

Check existing issues

Anything else?

No response

waptik commented 6 months ago

I can confirm the existence of this bug as I'm also getting similar errors:

$ bun run wrangler:deploy
$ wrangler deploy --minify src/index.tsx
 ⛅️ wrangler 3.50.0
-------------------
Fetching list of already uploaded assets...
Building list of assets to upload...
 = icon.6207b966a9.png (already uploaded icon.png)
Skipped uploading 1 existing asset.
↗️  Done syncing assets
Total Upload: 4228.45 KiB / gzip: 1100.45 KiB
▲ [WARNING] We recommend keeping your script less than 1MiB (1024 KiB) after gzip. Exceeding this can affect cold start time. Consider using Wrangler's `--minify` option to reduce your bundle size.

▲ [WARNING] Here are the 5 largest dependencies included in your script:

  - node_modules/frog/_lib/ui/icons.js - 1841.18 KiB
  - node_modules/workers-og/dist/resvg-LFIOYO65.wasm - 1341.69 KiB
  - node_modules/workers-og/dist/index.js - 400.18 KiB
  - node_modules/workers-og/dist/yoga-ZMNYPE6Z.wasm - 86.58 KiB
  - node_modules/@scure/bip39/esm/wordlists/korean.js - 71.91 KiB
  If these are unnecessary, consider removing them

✘ [ERROR] A request to the Cloudflare API (/accounts/[REDACTED]) failed.

  workers.api.error.script_too_large [code: 10027]

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

error: script "wrangler:deploy" exited with code 1
error: script "deploy" exited with code 1
carlaiau commented 6 months ago

Same here, on Cloudflare workers specifically

zerokarafont commented 6 months ago

upgrade workers to paid plan, max 10M size, solved my problem