Astro

Netlify adapter

Netlify adapter is the Astro adapter that packages on-demand routes as Netlify functions or edge functions. Static files go to Netlify's CDN.

How it is measured

Install @astrojs/netlify and add it to the config. The build writes function files into Netlify's expected folders. Choose between regular functions and edge functions through the adapter options.

Confirm by deploying a preview and calling an on-demand route. The Netlify deploy log lists the functions it found. A missing function means the route stayed static.

Worked example

A language school's site has 60 static pages and a /placement-test route that reads the query string and returns a result page. The adapter turns the route into one function. A deploy preview shows it in the functions tab with a cold start of about 400 ms.

The team moves the route to an edge function to cut that delay. Cold starts fall to about 40 ms, but a database client they use no longer runs there.

How it differs

The Netlify adapter emits Netlify functions. The Vercel adapter emits Vercel functions. Each fits only its host, and each excludes the other's deploy settings and limits.

Common errors

Deploying to Netlify with another host's adapter. Expecting the same limits as another provider. Ignoring function timeouts. Forgetting redirects belong in the right file. Using Node modules unsupported on edge functions.

In practice

Pick regular functions first and move to edge only when latency is your issue. Check the function list on a preview deploy. Keep static pages static.

See also

Astro adapter, Vercel adapter

Sources

Count this on a real site.

Watch my website