Skip to content

fix(ci): provide placeholder R2 env for the test suite - #26

Merged
iamparmjeet merged 2 commits into
mainfrom
fix/ci-r2-test-env
Sep 16, 2026
Merged

iamparmjeet merged 2 commits into
mainfrom
fix/ci-r2-test-env

Conversation

@iamparmjeet

Copy link
Copy Markdown
Owner

Problem

CI has been red on every run. packages/api/src/routers/test/avatar-delete.test.ts
fails at import because packages/api/src/routers/upload.ts:15 builds an
aws4fetch AwsClient at module scope from env.R2_ACCESS_KEY_ID /
env.R2_SECRET_ACCESS_KEY, and the CI "Write CI test env" step only wrote the
DB/auth/URL vars.

TypeError: accessKeyId is a required option
  packages/api/src/routers/upload.ts:15:12
  packages/api/src/routers/test/avatar-delete.test.ts:22:1

Result: 494 tests passed but the run exits 1 (1 failed suite), so every PR has
been unable to go green.

Fix

Add placeholder R2 credentials to the CI test env and to .env.test.example.
The tests make no storage calls, so placeholders suffice — the values only need
to be present for the module-scope client to construct (and R2_PUBLIC_URL /
R2_S3_ENDPOINT to be parseable URLs).

Verification

  • Ran the previously-failing suite locally with exactly these placeholders:
    avatar-delete.test.ts 5/5 pass.
  • This PR's own CI run is the end-to-end check.

Note (not done here)

Root cause is module-scope construction of a secret-dependent client. A
follow-up could lazy-init the R2 clients so importing upload.ts never
requires secrets; kept out of this slice to keep it a pure CI-env fix.

avatar-delete.test.ts imports routers/upload.ts, which builds an aws4fetch
AwsClient at module scope from env.R2_ACCESS_KEY_ID/SECRET. The CI test env
never set the R2 vars, so the whole suite failed at import with
"accessKeyId is a required option". Add placeholder values (tests make no
storage calls) and mirror them in .env.test.example so a local full-suite
run matches CI.
@vercel

vercel Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

4 Skipped Deployments
Project Deployment Actions Updated
rently-admin Ignored Ignored Sep 16, 2026 7:27pm UTC
rently-dashboard Ignored Ignored Sep 16, 2026 7:27pm UTC
rently-tenant Ignored Ignored Sep 16, 2026 7:27pm UTC
rently-web Ignored Ignored Sep 16, 2026 7:27pm UTC

The A03 bootstrap test pins .env.test.example and the CI heredoc to an exact
key set, so adding the placeholder R2 keys to both requires the guard's
expected map to grow too. Keeps the example == CI == expected invariant.
@iamparmjeet
iamparmjeet merged commit 53514f3 into main Sep 16, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant