fix(s3): default S3_REGION to us-east-1 instead of empty string#495
Merged
Conversation
The AWS SDK throws "Region is missing" when S3Client is constructed with an empty-string region, so any S3 feature (avatars, attachments, presigned URL generation) is silently broken when S3_REGION is unset — even though .env.example ships it unset and env.ts declares it optional. The schema and the runtime disagreed about whether the var was required. Default to "us-east-1" in createS3Client. S3-compatible providers (MinIO, Backblaze B2, R2, DigitalOcean Spaces, Wasabi) ignore the region entirely; real AWS S3 users should set S3_REGION explicitly to their bucket's actual region (clarified in .env.example). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
hjball
approved these changes
May 16, 2026
hjball
left a comment
Contributor
There was a problem hiding this comment.
Seems sensible to me @nickmeinhold
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.
Summary
The AWS SDK throws
Region is missingwhenS3Clientis constructed with an empty-string region, so any S3 feature (avatars, attachments, presigned URL generation) is silently broken whenS3_REGIONis unset — even though.env.exampleships it unset andapps/web/src/env.tsdeclares itoptional(). The schema and the runtime disagreed about whether the var was required.This PR defaults to
us-east-1increateS3Client. S3-compatible providers (MinIO, Backblaze B2, R2, DigitalOcean Spaces, Wasabi) ignore the region entirely; real AWS S3 users should setS3_REGIONexplicitly to their bucket's actual region (clarified in.env.example).Found while debugging an unrelated PDF-attachment issue (#494) — couldn't reproduce locally because the smoke harness exploded on
Region is missingbefore reaching the actual code path.Test plan
S3_REGIONunset, attachment upload no longer 500s onS3ClientconstructionS3_REGIONexplicitly set (e.g.eu-west-1), behaviour is unchanged🤖 Generated with Claude Code