Vercel, Svelte and Doom-Driven Development

I like SvelteKit. It feels less magical than most other similar tools I've used in the past and it works really well with small-, and medium-sized projects. It feels pragmatic: it helps me avoid making the decisions I don't want to make (yet).

Still, from time to time I stumble upon a gotcha. This one has to do with Vercel, SvelteKit adapters and the Medieval Content Farm.

Read Medieval Content Farm and Procedural Cheese for details. For the purposes of this post it should be enough to say that:

  1. every morning a CRON job tells our "editorial staff" to query Wall Street Journal and turn its news stories into poems
  2. those poems are then published as separate blog entries (e.g. this poem by Brother Arnulfus)

We have 4 authors, each writing at least one poem per day. The site has been running since April 2023. This means that we should generate ca. 1400 stories per year.

Now a month or so ago I started receiving these error messages from Vercel:

![](When you might not want to use the svelte/Pasted%20image%2020231016185416.png)

I was confused as I already used the Vercel adapter and set my pages to static using the prerender option:

export const prerender = true;

Also the number of published posts was definitely lower than 1024.

Approaches I tried:

  1. checking the build output and the resulting Vercel routing config
  2. switching to incremental server-side rendering (ISR)
  3. giving up for a month
    1. ☝️👍

1. seemed close, but I'd have to mess with redirects, possibly overly complex route matching rules. It smelled like one of those unnecessarily difficult, muddy problems with an annoyingly trivial solution.

Here's how I fixed it:

  1. I forgot about the problem
  2. I worked on something else (a static, self-hosted, personal alternative to Obsidian Publish attempted in a mad rush fuelled by a cascading stylesheet frustration and a serendipitous tweet). Important: it used @sveltejs/adapter-static.
  3. Eureka: why can't publish the Medieval Content Farm in the same way?

What was the problem:

The SvelteKit Vercel adapter creates separate routes for each static path, even with prerendering enabled.

Since I don't need to depend on dynamic routes in Medieval Content Farm, I could just switch to the static adapter, which will spit out all pages in HTML and serve them in the same way as all static assets. No fancy routing logic required.

++ import adapter from '@sveltejs/adapter-static';
-- import adapter from '@sveltejs/adapter-vercel';

Summary

Want to receive my work as I publish it? Subscribe here.

a giant foot-shaped snail with a house on its back. the house is still in construction, with a big crane towering above it The image is a stylized black-and-white illustration. In the lower left corner, there is a small, cozy-looking house with smoke rising from its chimney. The smoke, however, does not dissipate into the air but instead forms a dark, looming cloud. Within the cloud, the silhouette of a large, menacing face is visible, with its eyes and nose peeking through the darkness. The creature, perhaps a cat, appears to be watching over the house ominously, creating a sense of foreboding or unease.