Change8

@astrojs/db@0.21.0

Breaking Changes
📦 astroView on GitHub →
1 breaking1 features🐛 1 fixes🔧 3 symbols

Summary

This release introduces `getDbError()` for robust database error handling, addressing TypeScript narrowing issues caused by Drizzle wrappers, and patches a critical SQL injection vulnerability by updating `drizzle-orm`.

⚠️ Breaking Changes

  • The TypeScript return type for `isDbError()` has changed from a type predicate (`err is LibsqlError`) to a simple `boolean`. Code relying on TypeScript narrowing to access `.code` or `.message` directly on the error object after calling `isDbError(e)` will now fail compilation and must migrate to use `getDbError()`.

Migration Steps

  1. If you were using `isDbError()` to check for database errors and access properties like `.code` or `.message`, migrate this logic to use the new `getDbError()` helper function instead. See the example in the release notes for the required code change.

✨ New Features

  • Added a new helper function `getDbError()` exported from `astro:db`. This function inspects the error cause chain to reliably return the underlying `LibsqlError` when database errors occur, especially when wrapped by `drizzle-orm`.

🐛 Bug Fixes

  • Fixed a SQL injection vulnerability by updating `drizzle-orm` to `^0.45.2`, addressing GHSA-gpj5-g38j-94v9 (CVE-2026-39356).

Affected Symbols