Commit 07958747 authored by Stan Hu's avatar Stan Hu

Set a default region to Workhorse S3 client

By default, fog-aws uses "us-east-1" as the region, but the AWS SDK
does not. Transfers will fail if a region is not supplied:

```
MissingRegion: could not find region configuration
```

This commit sends Fog's default region (us-east-1) to ensure files get
uploaded properly.
parent 274d048c
---
title: Set a default region to Workhorse S3 client
merge_request: 59932
author:
type: fixed
......@@ -79,7 +79,7 @@ module ObjectStorage
Provider: 'AWS',
S3Config: {
Bucket: bucket_name,
Region: credentials[:region],
Region: credentials[:region] || ::Fog::AWS::Storage::DEFAULT_REGION,
Endpoint: credentials[:endpoint],
PathStyle: config.use_path_style?,
UseIamProfile: config.use_iam_profile?,
......
......@@ -126,6 +126,16 @@ RSpec.describe ObjectStorage::DirectUpload do
expect(s3_config.keys).not_to include(%i(ServerSideEncryption SSEKMSKeyID))
end
context 'when no region is specified' do
before do
raw_config.delete(:region)
end
it 'defaults to us-east-1' do
expect(subject[:ObjectStorage][:S3Config][:Region]).to eq('us-east-1')
end
end
context 'when feature flag is disabled' do
before do
stub_feature_flags(use_workhorse_s3_client: false)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment