Your Functions script is over the 1 MiB size limit (workers.api.error.script_too_large)

I have this error when deploy how to fix this
11 Replies
Vero
Vero11mo ago
Hi. That could be happening because the serverless code, in your function, is limited to 1 MB free / 10 MB Paid after compression. You still most of the time don’t want to go over the 1 MB threshold as your Worker gets higher startup times due/slower storage. Try to build the app locally and check the size of your _workers.js if you’re using a framework like next-on-pages which creates one. Also look for dependencies which you are using which can be trimmed. 1 MB is pretty large for a Worker/Function, should be possible to trim some
samerkhusein
samerkhuseinOP11mo ago
i upgraded the plan , but it does not make sense
Vero
Vero11mo ago
Is it working now?
samerkhusein
samerkhuseinOP11mo ago
no
Vero
Vero11mo ago
Are you still getting the same error?
samerkhusein
samerkhuseinOP11mo ago
yes the same error
Vero
Vero11mo ago
Could you please share the build log?
samerkhusein
samerkhuseinOP11mo ago
ok it's working now , but i have the a question how trim worker.js
Vero
Vero11mo ago
You can reduce the size of your function with minification, but probably you're using a framework which is already minifying But in case you need it, here are the docs for esbuild - https://esbuild.github.io/api/#minify
samerkhusein
samerkhuseinOP11mo ago
thank you
Want results from more Discord servers?
Add your server