mirror of
https://github.com/oven-sh/bun
synced 2026-02-15 05:12:29 +00:00
The issue occurs when users have AWS credentials from sources like IAM
roles, EC2 instance profiles, or ECS task roles that sccache automatically
detects, but those credentials don't have access to Bun's S3 bucket.
This fix implements two changes:
1. **SetupSccache.cmake**: Only configure S3 bucket when explicit Bun
credentials are available. When no explicit credentials are found,
set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY to "UNSET" to prevent
sccache from detecting AWS credentials from other sources.
2. **scripts/build.mjs**: Stop any running sccache daemon before building
to ensure it picks up the new environment variables from the .env file.
This is critical because sccache is a daemon that caches its configuration
when it starts.
The error looked like:
```
sccache: error: Server startup failed: cache storage failed to read:
PermissionDenied (permanent) at read => S3Error { code: "AccessDenied",
message: "Access Denied"
```
After this fix:
- In CI: Always configure S3 (credentials available via IAM role)
- read-only mode: Configure S3 with anonymous access
- Has explicit Bun credentials: Configure S3 with those credentials
- No explicit credentials: Disable S3, set AWS vars to "UNSET", and
restart sccache daemon to use local disk cache only
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>