Repository navigation
fix(ci): provide placeholder R2 env for the test suite - #26
Merged
Merged
Conversation
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.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 4 Skipped Deployments
|
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
CI has been red on every run.
packages/api/src/routers/test/avatar-delete.test.tsfails at import because
packages/api/src/routers/upload.ts:15builds anaws4fetchAwsClientat module scope fromenv.R2_ACCESS_KEY_ID/env.R2_SECRET_ACCESS_KEY, and the CI "Write CI test env" step only wrote theDB/auth/URL vars.
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_ENDPOINTto be parseable URLs).Verification
avatar-delete.test.ts5/5 pass.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.tsneverrequires secrets; kept out of this slice to keep it a pure CI-env fix.