parse-community / parse-community/parse-server-s3-adapter
Configured region is ignored in the string and positional constructor forms
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 80
- Forks
- 86
- PR merge metrics
- No merged PRs in 30d
Description
New Issue Checklist
- Report security issues confidentially.
- Any contribution is under this license.
- Before posting search existing issues.
Issue Description
region passed in the options object is silently discarded when the adapter is constructed with the string or positional forms. The adapter falls back to us-east-1, so both the S3 client and the generated file urls address the wrong region, with no warning.
optionsFromArguments copies an explicit list of fields out of the options object for those two forms:
if (otherOptions) {
options.bucketPrefix = otherOptions.bucketPrefix;
options.credentials = otherOptions.credentials;
options.directAccess = otherOptions.directAccess;
// ...
}
region is the only field in the defaults list further down that is missing from that copy list, so it never survives to fromEnvironmentOrDefault(options, 'region', 'S3_REGION', DEFAULT_S3_REGION) and takes the default.
Steps to reproduce
new S3Adapter('key', 'secret', 'bucket', { region: 'ap-east-1' })._region;
new S3Adapter('bucket', { region: 'ap-east-1' })._region;
new S3Adapter({ bucket: 'bucket', region: 'ap-east-1' })._region;
Actual Outcome
| Constructor form | _region |
|---|---|
('key', 'secret', 'bucket', { region }) |
us-east-1 |
('bucket', { region }) |
us-east-1 |
({ bucket, region }) |
ap-east-1 |
Expected Outcome
All three resolve to ap-east-1. region should behave like every other option, explicit value first, then S3_REGION, then the default.
Notes
The failure is silent, which is what makes it costly to diagnose. A bucket outside us-east-1 rejects writes with PermanentRedirect, and the reporter of #139 is a plausible instance: uploads worked, so their region did reach the client, meaning they used the object form or S3_REGION, while anyone on the positional form would see a different and more confusing failure.
Found while fixing #139. Both are the same underlying symptom, the configured region not being honored, so they are fixed together in the PR that closes this.
Environment
Adapter version: master, current lib/optionsFromArguments.js.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in lib/optionsFromArguments.js and trace how the string and positional constructor forms copy options before region resolution. Reproduce the three constructor forms from the issue, then verify that each preserves the explicit region while environment and default fallback behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, javascript
- Domain
- backend, cloud
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100