Users Don and pfaffman are experiencing a rebuild issue due to an error message “Cannot set dual-stack in combination with a custom endpoint” when using S3 object storage with Digital Ocean Spaces. Don temporarily fixed the issue by commenting out the S3 upload lines, but this caused the site to get stuck on the splash screen. pfaffman suggested that the issue might be related to the S3_REGION environment variable.
Martin acknowledged the issue and explained that the fix is to never use dualstack if DISCOURSE_S3_ENDPOINT has been set, as they are incompatible. Martin later merged a fix for the issue. However, merefield pointed out that the change may have caused a break in backups on several instances, and pfaffman agreed that the fix only applies to sites using use_s3 and not those using S3 only for backups. Martin eventually fixed the backup issue.
The discussion involves nat, Falco, and martin, with pfaffman confirming that the fix worked for him. The issue highlights the importance of considering compatibility with S3 clones and the need for broader specs to capture all real-use cases.
I, [2024-11-07T08:00:56.758061 #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."
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && sudo -E -u discourse bundle exec rake s3:upload_assets failed with return #<Process::Status: pid 3349 exit 1>
Location of failure: /usr/local/lib/ruby/gems/3.3.0/gems/pups-1.2.1/lib/pups/exec_command.rb:132:in `spawn'
exec failed with the params {"cd"=>"$home", "cmd"=>["sudo -E -u discourse bundle exec rake s3:upload_assets", "sudo -E -u discourse bundle exec rake s3:expire_missing_assets"]}
bootstrap failed with exit code 1
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
./discourse-doctor may help diagnose the problem.
567dc9e1f9a4e662de6024b8504915d8b6ef1ee2d9b4303af75323ba478679e4
My rebuild with a Digital Ocean Spaces S3 setup started failing with this error:
, [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'
But omitting setting it to whatever makes the build fail like this:
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 -- :
@martin usually what we do here is providing a GlobalSetting to disable the behavior that people running incompatible S3 clones can then opt-in to make it work.
IMO, the current behavior should stay as the default, but provide toggles to increase compatibility.
See prior art in DISCOURSE_S3_HTTP_CONTINUE_TIMEOUT, DISCOURSE_S3_INSTALL_CORS_RULE, etc.
Ah sorry my bad here everyone, these S3 clones always slip my mind. I actually had to fix this custom endpoint issue with Minio yesterday. I think the fix here can just to be never use dualstack if DISCOURSE_S3_ENDPOINT has been set since they are incompatible, and everyone here is seemingly using that.
That’s because there’s a lot of stuff to keep in mind! And the spec tests, I think, would require those annoying stub_requests which I know I hate writing.
FWIW, that sounds right to me. And you could probably write tests for that that didnt’ require stubs for stub_requests.