How to keep a serverless bundle small
If a blob exists so a job can resume, it does not belong on the request path.
A common failure is to deploy the data you computed next to the code that serves it. The function gets large, cold starts get slow, and the page still only renders twenty rows.
What the client may receive
A page of results: titles, scores, and a cursor. A catalog of "which things are we comparing" can be a small JSON file. Leaderboards should read that file, not the raw ingest.
If a model call can fail, the page still needs an answer that does not depend on it. Compute that answer first. Make the model call opt-in. If it fails, leave the first answer on screen.
The crawl is a job
Ingest on a schedule. Dedupe and rank before a reader can see the result. The function serves the output of that job. It does not start the crawl because someone opened the homepage.
Look at the deployment size the way you look at a failing test. A function near 100 MB is a failing test that happens to return 200.
The same cut for a blog
Ship the document, not the toolchain that produced it. A post can be an HTML file with a title and a date. Search does not need the editor session. The tags that matter are listed in what a crawlable post contains.
Topics Next.jsWeb Platform