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