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 | OOO Public Holiday
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
samerkhuseinOP16mo ago
i upgraded the plan , but it does not make sense
Vero | OOO Public Holiday
Is it working now?
samerkhusein
samerkhuseinOP16mo ago
no
Vero | OOO Public Holiday
Are you still getting the same error?
samerkhusein
samerkhuseinOP16mo ago
yes the same error
Vero | OOO Public Holiday
Could you please share the build log?
samerkhusein
samerkhuseinOP16mo ago
ok it's working now , but i have the a question how trim worker.js
Vero | OOO Public Holiday
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
samerkhuseinOP16mo ago
thank you

Did you find this page helpful?