Skip to content

v0.4.1 — fail safe by default

Choose a tag to compare

@baer baer released this 06 Jul 22:29
· 947 commits to main since this release
29fbbca

Fail safe by default

baerly-storage 0.4.1 is an operational-hardening release. The theme: when something is misconfigured, fail loud at boot instead of quietly losing data. Plus two new ways to run it — Cloudflare Workers over S3, and S3 on EKS.

Note: 0.4.1 supersedes 0.4.0, which has been deprecated on npm. 0.4.0 shipped a mis-stamped kernelVersion ("0.3.0") in its served /v1/spec; 0.4.1 corrects it and is otherwise identical to 0.4.0. Install 0.4.1.

Fail closed, not silent

The failure mode this release closes: an app falls back to in-memory or local-disk storage in production, writes "succeed" into RAM or an ephemeral container disk, then vanish on the next restart with no signal.

  • MemoryStorage refuses to construct in a detected deployment (NODE_ENV=production or a known PaaS marker) unless you explicitly pass { ephemeral: true } or set BAERLY_ALLOW_EPHEMERAL_STORAGE=true. Tests, local dev, and CI are unaffected.
  • The Node example servers fail loud in a deployment when a real bucket is missing or typo'd — they won't silently run on the local-fs dev fallback.
  • Invalid object keys are rejected before the wire. . / .. / empty keys now throw a clear InvalidConfig on every adapter, instead of drawing an opaque bucket-root 403.
  • sigV4Signer fails fast on blank or whitespace-only credentials rather than signing with empty values and drawing a 403.

Runs in more places

  • Cloudflare Workers can now use S3-compatible storage over HTTP, not just a native R2 binding — via the new Worker-safe @gusto/baerly-storage/s3 subpath. Opt-in; the R2 binding stays the default.
  • S3 on EKS works out of the box. New fromWebIdentity() and fromEks() credential providers add IRSA (AWS_ROLE_ARN + AWS_WEB_IDENTITY_TOKEN_FILE) support alongside the existing Pod Identity path — no AWS SDK dependency.
  • Zero-credential local dev. The new localFsStorage() factory lets Node apps run against the local filesystem in development and promote to S3/R2 once bucket env vars are set.

Also in this release

  • New type exports — PredicateArg, Predicate, Collection (root) and PredicateArg (/client) — so you can name .where(...) arguments directly. Fixes a Path<T> bug where an optional array field broke predicate typing.
  • Smaller S3 bundle — swapped fast-xml-parser for @rgrove/parse-xml: −87 KiB raw / −14 KiB min-gz on the s3.js closure, zero transitive deps, and the XML-entity-expansion CVE class can no longer recur.
  • Durable-contract promises written down — LogEntry is versionless and additive-only, version axes are drift-gated, and storage capabilities are split required vs. optional. Docs + internal tooling only; no runtime change.

Upgrade

pnpm add @gusto/baerly-storage@0.4.1

No action required for apps already on a real S3/R2 bucket. The one thing to know: if you were (accidentally) running on in-memory or local-fs storage in a deployment, it will now refuse to boot — that's the point.


Full changelog + migration notes: CHANGELOG.md

📦 npm · 📚 Docs · 🧠 Theory