Skip to content

fix: support S3-compatible services (MinIO) - #14

Open
applearound wants to merge 1 commit into
NitroRCr:mainfrom
applearound:fix/s3-minio-compat
Open

fix: support S3-compatible services (MinIO)#14
applearound wants to merge 1 commit into
NitroRCr:mainfrom
applearound:fix/s3-minio-compat

Conversation

@applearound

Copy link
Copy Markdown

I deploy Minio for self host s3 service, but is seems unsupportted.

Uploading files to self-hosted S3-compatible services (e.g. MinIO) fails with:

body must be a string, ArrayBuffer or ArrayBufferView, unless you include the X-Amz-Content-Sha256 header.

Root cause: aws4fetch cannot parse service and region from non-AWS endpoints (like localhost), which causes:

  1. The automatic X-Amz-Content-Sha256: UNSIGNED-PAYLOAD header (only set when service === 's3') is not applied
  2. ReadableStream body fails to sign because aws4fetch can't hash it
  3. X-Amz-Credential in the Authorization header contains wrong service, rejected by MinIO

Additionally, S3_REGION was declared in docker-compose.example.yml but never read by the code.

  • Add service:'s3' to AwsClient to fix ReadableStream signing
  • Add S3_PROTOCOL config (default: https)
  • Add S3_TYPE config for virtual-hosted vs path-style URLs
  • Read S3_REGION from env (was declared in docker-compose but unused)

No breaking changes for existing AWS S3 users — all new configs have defaults matching current behavior.

- Add service:'s3' to AwsClient to fix ReadableStream signing
- Add S3_PROTOCOL config (default: https)
- Add S3_TYPE config for virtual-hosted vs path-style URLs
- Read S3_REGION from env (was declared in docker-compose but unused)
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