# La configuration DISCOURSE\_S3\_REGION : whatever ne fonctionne plus

**URL:** <https://meta.discourse.org/t/setting-discourse-s3-region-whatever-no-longer-works/335025>\
**Category:** Bug\
**Created:** [Novembre 7, 2024, 7:24 UTC](https://meta.discourse.org/t/setting-discourse-s3-region-whatever-no-longer-works/335025 "2024-11-07T19:24:07Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [Novembre 7, 2024, 7:24 UTC](https://meta.discourse.org/t/setting-discourse-s3-region-whatever-no-longer-works/335025/1 "2024-11-07T19:24:07Z")

</div>

Ma reconstruction avec une configuration Digital Ocean Spaces S3 a commencé à échouer avec cette erreur :

```plaintext
, [2024-11-07T19:09:38.615466 #1] INFO -- : cd /var/www/discourse & sudo -E -u discourse bundle exec rake s3:upload_assets
rake aborted!
ArgumentError: Cannot set dual-stack in combination with a custom endpoint. (ArgumentError)
          raise ArgumentError, "Cannot set dual-stack in combination with a custom endpoint."
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/aws-sdk-s3-1.143.0/lib/aws-sdk-s3/endpoint_provider.rb:34:in `resolve_endpoint'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/aws-sdk-s3-1.143.0/lib/aws-sdk-s3/plugins/endpoints.rb:37:in `call'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/aws-sdk-core-3.191.3/lib/seahorse/client/plugins/endpoint.rb:47:in `call'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/aws-sdk-core-3.191.3/lib/aws-sdk-core/plugins/param_validator.rb:26:in `call'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/aws-sdk-s3-1.143.0/lib/aws-sdk-s3/plugins/sse_cpk.rb:24:in `call'

```

Mais omettre de le définir sur `whatever` fait échouer la construction comme ceci :

```plaintext

I, [2024-11-07T19:15:31.060936 #1] INFO -- : cd /var/www/discourse & sudo -E -u discourse bundle exec rake s3:upload_assets
ERROR: Ensure S3 is configured in config/discourse.conf or environment vars
I, [2024-11-07T19:15:36.056204 #1] INFO -- :

```

J’ai trouvé ceci :

> <https://github.com/hashicorp/terraform-provider-aws/issues/37878>
>
> \### Description
> 
> The \`use\_dualstack\_endpoint\` parameter instructs the AWS SDK en…dpoint resolver to return a dual-stack endpoint. If a custom endpoint is configured for a service, the resolver returns an error.
> 
> When a custom endpoint is supplied for a service, the value of \`use\_dualstack\_endpoint\` must be ignored.
> 
> Test the following combinations:
> 
> \* Use dual-stack endpoint set on the provider, shared configuration file, or environment variable
> \* No custom endpoint (returns default dual-stack endpoint), custom endpoint set on the provider, shared configuration file, or environment variable, base endpoint set in shared configuration file or environment variable (#32649 suggests adding base endpoint configuration on the provider)
> 
> 
> \### References
> 
> See #37876 for the equivalent issue with FIPS endpoints
> 
> \### Would you like to implement a fix?
> 
> None

et ceci :

> <https://github.com/aws/aws-sdk-php/issues/2614>
>
> \### Describe the bug
> 
> After the update to version 3.243.0 and I think the start …of using Aws\\EndpointV2 it would appear that the option for \`use\_dual\_stack\_endpoint\` and possibly \`use\_fips\_endpoint\` are always true. This prevents multipart uploads which use accelerator and any writes that use accelerator with possible other issues as a result.
> 
> When tracing through the updates made in 3.243.0 and subsequent updates I was unable to determine where the options are actually being set to true, or if the default behavior for these options is being assumed as true on the AWS end and explicitly setting them to false is being ignored.
> 
> I am using Laravel 9 with league/flysystem-aws-s3-v3 but the issue appears to be isolated with changes starting with aws-sdk-php v3.243.0 and later. Explicitly setting \`"aws/aws-sdk-php": "3.242.1"\` in composer resolves the issue
> 
> \### Expected Behavior
> 
> Default values for \`use\_dual\_stack\_endpoint\` and \`use\_fips\_endpoint\` is false.
> Setting env variables \`AWS\_USE\_DUAL\_STACK\_ENDPOINT\` and \`AWS\_USE\_FIPS\_ENDPOINT\` to false is respected.
> 
> \### Current Behavior
> 
> Default values for \`use\_dual\_stack\_endpoint\` and \`use\_fips\_endpoint\` appears to be true.
> Setting env variables \`AWS\_USE\_DUAL\_STACK\_ENDPOINT\` and \`AWS\_USE\_FIPS\_ENDPOINT\` to false is ignored.
> 
> \### Reproduction Steps
> 
> Create an S3 client with default Laravel S3 config and create a multipart upload
> \`\`\`
> $client = Storage::disk('s3')-\>getClient();
>  
> $result = $client-\>createMultipartUpload(\[
> 'Bucket' =\> $bucket,
> 'Key' =\> $key,
> 'ContentType' =\> $type,
> 'ContentDisposition' =\> 'inline',
> \]);
> \`\`\`
> Results in error \`Host override cannot be combined with Dualstack, FIPS, or S3 Accelerate\`
> 
> Environment variables used
> 
> \`\`\`
> AWS\_ACCESS\_KEY\_ID=\*\*\*\*\*
> AWS\_SECRET\_ACCESS\_KEY=\*\*\*\*\*
> AWS\_DEFAULT\_REGION=ca-central-1
> AWS\_BUCKET=my-bucket-name
> AWS\_URL="https://s3.amazonaws.com"
> AWS\_POST\_END\_POINT="https://${AWS\_BUCKET}.s3.amazonaws.com/"
> AWS\_USE\_PATH\_STYLE\_ENDPOINT=false
> AWS\_USE\_ACCELERATE\_ENDPOINT=true
> AWS\_USE\_DUAL\_STACK\_ENDPOINT=false
> AWS\_USE\_FIPS\_ENDPOINT=false
> \`\`\`
> 
> \### Possible Solution
> 
> \_No response\_
> 
> \### Additional Information/Context
> 
> The specific error \`Host override cannot be combined with Dualstack, FIPS, or S3 Accelerate\` does not appear to be common but has recently been reported with aws cli on stackoverflow indicating it may actually result from a more recent change on AWS/S3 side of things.
> 
> \### SDK version used
> 
> 3.243.0
> 
> \### Environment details (Version of PHP (\`php -v\`)? OS name and version, etc.)
> 
> php 8.0.12, laravel/framerwork ^9.0, league/flysystem-aws-s3-v3 ^3.0, aws/aws-sdk-php ^3.243.0

Peut-être que S3\_REGION devrait être effacé si un endpoint est défini ici ?

> <https://github.com/discourse/discourse/blob/main/lib/file_store/to_s3_migration.rb#L48>

@Falco Je pense que c’est dans votre domaine.

---

_[View the full topic](https://meta.discourse.org/t/setting-discourse-s3-region-whatever-no-longer-works/335025)._
