S3 error, when updating to 2.9.0.beta1

AI-generated summary

A user encountered an S3 error during the update of their Discourse dev instance from 2.8.0beta11 to 2.9.0beta1, with the error indicating a missing Content-Length header when uploading assets to S3. dirien noted the issue occurred after a gem update, and Falco suggested checking MinIO configuration, as compatibility issues might have arisen. dirien confirmed the configuration was correct and the 2.8.0beta11 build worked fine. Eventually, dirien resolved the issue by moving away from MinIO, indicating the problem was likely related to the S3 gem or MinIO compatibility.

Hi everyone,

tried the search and did not find anything.

We run Discourse 2.8.0beta11 fine on our dev and prod systems on-site. So far so good.

Now I tried to update our dev instance to 2.9.0beta1 and I get following error during the build process of the container:

...
I, [2022-02-15T09:19:20.137108 #1] INFO -- : > cd /var/www/discourse && sudo -E -u discourse bundle exec rake s3:upload_assets
rake aborted!
Aws::S3::Errors::MissingContentLength: You must provide the Content-Length HTTP header.
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/aws-sdk-core-3.121.2/lib/seahorse/client/plugins/raise_response_errors.rb:17:in `call'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/aws-sdk-s3-1.96.1/lib/aws-sdk-s3/plugins/sse_cpk.rb:24:in `call'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/aws-sdk-s3-1.96.1/lib/aws-sdk-s3/plugins/dualstack.rb:36:in `call'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/aws-sdk-s3-1.96.1/lib/aws-sdk-s3/plugins/accelerate.rb:50:in `call'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/aws-sdk-core-3.121.2/lib/aws-sdk-core/plugins/jsonvalue_converter.rb:22:in `call'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/aws-sdk-core-3.121.2/lib/aws-sdk-core/plugins/idempotency_token.rb:19:in `call'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/aws-sdk-core-3.121.2/lib/aws-sdk-core/plugins/param_converter.rb:26:in `call'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/aws-sdk-core-3.121.2/lib/seahorse/client/plugins/request_callback.rb:71:in `call'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/aws-sdk-core-3.121.2/lib/aws-sdk-core/plugins/response_paging.rb:12:in `call'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/aws-sdk-core-3.121.2/lib/seahorse/client/plugins/response_target.rb:24:in `call'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/aws-sdk-core-3.121.2/lib/seahorse/client/request.rb:72:in `send_request'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/aws-sdk-s3-1.96.1/lib/aws-sdk-s3/client.rb:11274:in `put_object'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/aws-sdk-s3-1.96.1/lib/aws-sdk-s3/object.rb:1329:in `put'
/var/www/discourse/lib/s3_helper.rb:74:in `upload'
/var/www/discourse/lib/tasks/s3.rake:37:in `block in upload'
/var/www/discourse/lib/tasks/s3.rake:36:in `open'
/var/www/discourse/lib/tasks/s3.rake:36:in `upload'
/var/www/discourse/lib/tasks/s3.rake:192:in `block (2 levels) in <main>'
/var/www/discourse/lib/tasks/s3.rake:191:in `each'
/var/www/discourse/lib/tasks/s3.rake:191:in `block in <main>'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'
Tasks: TOP => s3:upload_assets
(See full trace by running task with --trace)
I, [2022-02-15T09:19:30.893646 #1] INFO -- : Installing CORS rules...
skipping
Skipping: assets/browser-detect-16ca87077aead9f656700e192992122d3a7eee8c1bb76da992127945464d4777.js
Skipping: assets/browser-detect-16ca87077aead9f656700e192992122d3a7eee8c1bb76da992127945464d4777.br.js
Skipping: assets/browser-detect-16ca87077aead9f656700e192992122d3a7eee8c1bb76da992127945464d4777.gz.js
Skipping: assets/browser-detect-16ca87077aead9f656700e192992122d3a7eee8c1bb76da992127945464d4777.js.map
Skipping: assets/browser-update-eec13eb6f8386f18f10b5dd6ebb7a3598d28421bb796e539b91a7e4a4c5d4c08.js
Skipping: assets/browser-update-eec13eb6f8386f18f10b5dd6ebb7a3598d28421bb796e539b91a7e4a4c5d4c08.br.js
Skipping: assets/browser-update-eec13eb6f8386f18f10b5dd6ebb7a3598d28421bb796e539b91a7e4a4c5d4c08.gz.js
Skipping: assets/browser-update-eec13eb6f8386f18f10b5dd6ebb7a3598d28421bb796e539b91a7e4a4c5d4c08.js.map
...

What does Aws::S3::Errors::MissingContentLength: You must provide the Content-Length HTTP header. means here?

Our S3 is a MinIO and works perfect for us.

Thanks for the help.

Have you configured MinIO as specified in Using Object Storage for Uploads (S3 & Clones)? If so it may be that an update of either the S3 gem or from MinIO broke the compatibility.

Since only the real S3 is what we build against, this may need to be brought to MinIO.

Guess the base image of discourse updated the ruby gem version from aws-cdk-s3 from 1.90 to 1.96… Need to check if there is some breaking changes…

The settings you linked are fine, as I wrote. The build of version 2.8.0beta11 is working fine… So no update until I found the issue or I am screwed :smiley:

HI @Falco, i moved from MiniIO away and it works again! Thanks for helping me out!