From be27817c64afc8a814465112358a00bde12def26 Mon Sep 17 00:00:00 2001 From: wudidapaopao Date: Wed, 1 Jul 2026 14:06:58 +0800 Subject: [PATCH] Fix Vercel build: derive the cache dir from the engine version, not md5sum MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Vercel build image doesn't ship `md5sum`, so `build-vercel.sh` failed with exit 127 at the content-hash step. Since chdb-wasm is pinned (npm versions are immutable), the package version fully identifies the engine bytes — use it as the cache-busting dir name, computed with node (always present in the build) instead of md5sum. Co-Authored-By: Claude Opus 4.8 --- scripts/build-vercel.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/build-vercel.sh b/scripts/build-vercel.sh index 1a2ae81..de8f4fe 100644 --- a/scripts/build-vercel.sh +++ b/scripts/build-vercel.sh @@ -25,11 +25,11 @@ WEB="${2:-web}" OUT="${3:-out}" JS="index.js worker.js async.js bindings.js protocol.js status.js platform.js" -# Content-hashed dir name covering the mt engine files, so any engine change busts the -# immutable cache. 16 hex chars (64 bits) keep collisions negligible. -HASH_INPUT="" -for f in $JS chdb.mjs chdb.wasm; do HASH_INPUT="$HASH_INPUT $DIST/$f"; done -VER="dist-$(cat $HASH_INPUT | md5sum | cut -c1-16)" +# Cache-busting dir name = the installed engine's version. npm versions are immutable, so +# the version fully identifies the engine bytes: a new engine => new version => new dir => +# fresh fetch, with no stale-cache risk. Computed with node (always present in a Vercel +# build) rather than md5sum, which the build image does not ship. +VER="dist-$(node -pe "JSON.parse(require('fs').readFileSync('$(dirname "$DIST")/package.json','utf8')).version")" rm -rf "$OUT" mkdir -p "$OUT/$VER"