Commit 310f0d9
[1035] Fix S3 attachment uploads for ACL-disabled buckets (#264)
fix(uploadfs): disable S3 ACL usage for attachment uploads
## Summary
- Fixes Apostrophe attachment upload failures caused by S3 buckets with
ACLs disabled (`AccessControlListNotSupported`).
- Updates `@apostrophecms/uploadfs` config to avoid sending ACL by
default (`acl: null`) unless explicitly provided via `APOS_S3_ACL`.
- Makes S3 `endpoint`, `style`, and `https` options optional so
production AWS S3 works without LocalStack-specific env vars.
- Aligns local LocalStack bucket initialization with `APOS_S3_BUCKET` to
prevent local `NoSuchBucket` errors.
## Root Cause
Uploads were sending ACL-related settings to buckets configured with
Object Ownership that disallows ACLs, causing `500` errors from
`/api/v1/@apostrophecms/attachment/upload`.
## Validation
- Verified local upload now succeeds.
- Confirmed previous ACL error is no longer triggered.
- Confirmed local bucket mismatch issue was resolved for development
environment.
## Notes
- `docker-compose.yml` LocalStack bucket change is development-only.
- Production impact comes from `uploadfs` ACL/config handling changes.
- For production, keep `APOS_S3_ACL` unset unless explicitly needed.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
Updated S3 upload configuration in the uploadfs module to support
buckets with ACLs disabled. This change makes endpoint, style, and https
options conditional (only set when corresponding environment variables
are present) and defaults the ACL setting to null unless APOS_S3_ACL is
explicitly configured, preventing AccessControlListNotSupported errors
during attachment uploads.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Co-authored-by: Ihor Masechko <ihormasechko@Ihors-MacBook-Air.local>1 parent 3a3a823 commit 310f0d9
1 file changed
+16
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
10 | | - | |
11 | | - | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
19 | 31 | | |
20 | 32 | | |
21 | 33 | | |
| |||
0 commit comments