From b509426ec01deb94e621dfe4d1a593367d5ee65a Mon Sep 17 00:00:00 2001 From: Naor Peled Date: Sat, 8 Aug 2026 19:46:10 +0300 Subject: [PATCH] fix(ci): build dist before running benchmarks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The benchmark adapter loads lambda-api from the working tree via require('../../'), which resolves through the root package's "main". #326 changed that from index.js to ./dist/cjs/index.js, so the adapter now needs a build that the workflow never performed — it only ran npm ci inside benchmarks/. The job crashed on the first lambda-api scenario with MODULE_NOT_FOUND. Also honor LAMBDA_API_VERSION in the adapter. run.js already used it for the caption, but the per-framework table rows read package.json directly, so every row rendered as 0.0.0-development. --- .github/workflows/benchmark.yml | 9 +++++++++ benchmarks/frameworks/lambda-api.js | 7 ++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 7214836..79cb019 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -42,6 +42,15 @@ jobs: RAW="${{ github.event.release.tag_name || inputs.version }}" echo "value=${RAW#v}" >> "$GITHUB_OUTPUT" + # The benchmark adapter loads lambda-api from the working tree via require('../../'), + # which resolves through the root package's "main" (./dist/cjs/index.js). That path + # only exists after a build, so the root package must be installed and built first. + - name: Install root dependencies + run: npm ci --ignore-scripts + + - name: Build dist (CJS + ESM) + run: npm run build + - name: Install benchmark dependencies working-directory: benchmarks run: npm ci diff --git a/benchmarks/frameworks/lambda-api.js b/benchmarks/frameworks/lambda-api.js index 96ed48e..67f80d8 100644 --- a/benchmarks/frameworks/lambda-api.js +++ b/benchmarks/frameworks/lambda-api.js @@ -26,4 +26,9 @@ function build() { return (event, context) => api.run(event, context); } -module.exports = { name: 'lambda-api', version: pkg.version, build }; +// package.json ships a 0.0.0-development placeholder (the real version is stamped at +// publish time), so prefer the release label the workflow passes in — same precedence +// as the run metadata in run.js. +const version = process.env.LAMBDA_API_VERSION || pkg.version; + +module.exports = { name: 'lambda-api', version, build };