I am trying to upload my Gatsby Site to the workers API, but I’m getting the following errors:

Error: Something went wrong! Status: 400 Bad Request, Details {
“result”: null,
“success”: false,
“errors”: [
“code”: 10027,
“message”: “workers.api.error.script_too_large”

When I build it, the site is 650mb. How can I get around this error?

There’s probably a single script or a single file that’s bigger than the max allowed size of 10MB.

You can configure the bundler to split files (that can be splitted) into smaller chunks.

Keep in mind, with that many files being in the KV, every request to a file will create a request counted towards the worker costs. So if you have a big landing site which cause 30+ requests on every page-view, you’ll be able to get 333K page-views for 5$. If cost is an issue, a VPS would be cheaper (but not globally distributed).

Check the guide over on the Gatsby website on how to deploy your Gatsby site with Cloudflare Wrangler :slight_smile:

Cloudflare Wrangler by default will cache subsequent requests made to your static files in KV, so no need to worry about cost here :slight_smile:

Every request made to a worker will count at cost, even those in cache - subrequests will not count as often though, that’s why I didn’t count them. So depending on cache-time, it’s even costlier than above.