Astro 7.3

By
Matthew Phillips

Astro 7.3 is here! This release brings the --ignore-lock flag to astro preview, so you can run more than one preview server at once. It also passes Astro’s runtime logger into custom image services and cache providers, so their warnings respect your logging setup instead of writing straight to the console. Alongside the release, @astrojs/cloudflare ships a finalize() helper for custom worker entrypoints.

Explore what’s new in this release:

To upgrade an existing project, use the automated @astrojs/upgrade CLI tool. Alternatively, upgrade manually by running the upgrade command for your package manager:

# Recommended:
npx @astrojs/upgrade
# Manual:
npm install astro@latest
pnpm upgrade astro --latest
yarn upgrade astro --latest

Run multiple preview servers at once

Astro 7.1 added an --ignore-lock flag to astro dev so you could run more than one dev server at once, bypassing the lockfile that keeps AI agents from spinning up duplicates. Astro 7.2 added that lockfile to astro preview too, but without the same escape hatch. Astro 7.3 closes that gap.

astro preview --ignore-lock

There are some cases where you might want multiple dev or preview servers running. One example is when doing Playwright tests. Now you can pass --ignore-lock to allow them to run at once.

These instances run independently, so they’re meant for quick, one-off servers rather than ones you manage with astro preview stop or status.

Logger for image services and cache providers

Astro’s custom logger lets you route Astro’s own output to your logging setup, but custom image services and cache providers couldn’t take advantage of it. If they needed to warn about something, like an unsupported image format or a skipped cache entry, their only option was console.warn(), which ignores your configured log level, destination, or the --silent flag entirely.

Astro 7.3 passes a logger into both extension points. Image services receive it as an argument to their hooks:

import type { LocalImageService } from 'astro';
const service: LocalImageService = {
// ...
async transform(inputBuffer, transform, imageConfig, logger) {
logger.warn(`Could not optimize "${transform.src}". Passing it through unchanged.`);
return { data: inputBuffer, format: 'png' };
},
};

Cache providers receive it on the context passed to onRequest():

import type { CacheProvider } from 'astro';
const provider: CacheProvider = {
name: 'my-cache',
async onRequest({ request, url, logger }, next) {
logger.warn(`Skipping cache for ${url.pathname} because the response sets a cookie.`);
return next();
},
// ...
};

Astro’s own built-in Sharp image service and memoryCache() provider have been updated to use this too, so their warnings behave the same as the rest of Astro’s output.

Cloudflare finalize() helper for custom fetch handlers

If you have a custom worker entrypoint on Cloudflare, @astrojs/cloudflare now ships a finalize() helper that applies cookies and Cloudflare’s CDN cache defaults to the response coming out of an astro/fetch pipeline:

src/worker.ts
import { astro, FetchState } from 'astro/fetch';
import { cf, finalize } from '@astrojs/cloudflare/fetch';
export default {
async fetch(request: Request, env: Env, context: ExecutionContext) {
const state = new FetchState(request);
const asset = await cf(state, env, context);
if (asset) return asset;
return finalize(state, await astro(state));
},
};

With Hono, the @astrojs/cloudflare/hono middleware applies these headers automatically, so there’s nothing extra to call.

Other improvements

For a complete list of bug fixes and smaller improvements, see the full changelog.

Community

The Astro core team is:

Alexander Niebuhr, Armand Philippot, Chris Swithinbank, Emanuele Stoppa, Erika, Florian Lefebvre, Fred Schott, HiDeoo, Luiz Ferraz, Matt Kane, Matthew Phillips, Reuben Tier, Sarah Rainsberger, and Yan Thomas.

Special thanks to everyone who contributed to Astro 7.3 with code, docs, reviews, and testing, including:

Aleksandr Smyshliaev, Alisson Nunes, Angel Marfil, angelo 🦈, Arnold, Ashleigh Yeoman, Barry, bulebrainbrand, Chuck Reynolds, Constantine, Daniel, Dawid Gaweł, Eknath, Eric Clemmons, Eric Park, Espen Hovlandsdal, Ethan Stoner, Felix Schneider, fkatsuhiro, Jawad Ali, Johannes Grof │ Dev, Junseong Park, Kesley David, Konrad Szajna, Kosta, Kynson Szetau, Lazizbek Ergashev, ld-web, Linserin Yang, Louis Escher, markws62, Marnik Bercx, Martin Trapp, Miklós Csepella, Miodrag Obradovic, mkismy, Ngo Quoc Viet, ocavue, paul valladares, Roman, Sakku 🦉, Sebastiaan Saarloos, Shinya Fujino, swaggysnippets, Tarik Ermis, thelazylama, Thomas Bonnet, tianrking, Ujjwal Gupta, Wahid Rizka Fathurrohman, Waqas Ahmed, Yoann Fleury, and

We hope you enjoy Astro 7.3. If you run into issues or want to share feedback, please join us on Discord, post on GitHub, or reach out on Bluesky, Twitter, and Mastodon.