# Seahorse::Client::NetworkingError：响应正文为空或不完整（Seahorse::Client::NetworkingError）

**URL:** <https://meta.discourse.org/t/seahorse-empty-or-incomplete-response-body-seahorse-networkingerror/361244>\
**Category:** Support\
**Tags:** s3, cloudflare\
**Created:** [2025年四月10日 12:59 UTC](https://meta.discourse.org/t/seahorse-empty-or-incomplete-response-body-seahorse-networkingerror/361244 "2025-04-10T12:59:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![joshhabka](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/joshhabka/32/452328_2.png) [@joshhabka](https://meta.discourse.org/u/joshhabka)\
**Post date:** [2025年四月10日 12:59 UTC](https://meta.discourse.org/t/seahorse-empty-or-incomplete-response-body-seahorse-networkingerror/361244/1 "2025-04-10T12:59:28Z")

</div>

运行命令时 `sudo -E -u discourse bundle exec rake s3:upload_assets`

我正在使用 Cloudflare R2，配置为 S3，来自这篇文章：

> [@How to Configure Cloudflare R2 for your Discourse Community](https://meta.discourse.org/t/how-to-configure-cloudflare-r2-for-your-discourse-community/349512/8):
>
> Just to update this post I had some gotchas that needed to be included before cloudflare worked for me. 1. Region This wasn’t true, I had to use “auto” or the region I selected, auto is easier so use auto. if you need to know which options you can use, try with any random string in your region and: sudo -E -u discourse bundle exec rake s3:upload\_assets play_button If you use nixos This will spit out an error for your valid options 2. API permissions It’s also important to know that the restric…

我最初尝试了相同的命令，`sudo -E -u discourse bundle exec rake s3:upload_assets` 但结果是：

```plaintext
/root is not writable.
Bundler will use /tmp/bundler20250409-510203-w6snye510203 as your home directory temporarily.
ERROR: Ensure S3 is configured in config/discourse.conf or environment vars

```

所以，我将配置作为环境变量放在 app.yml 中 - 看起来是这样的：

```plaintext
## S3 Configuration
  DISCOURSE_USE_S3: true
  DISCOURSE_S3_REGION: us-east-1
  DISCOURSE_S3_ACCESS_KEY_ID: xxx
  DISCOURSE_S3_SECRET_ACCESS_KEY: xxx
  DISCOURSE_S3_CDN_URL: https://pub-xxx.r2.dev
  DISCOURSE_S3_ENDPOINT: https://xxx.r2.cloudflarestorage.com/xxx
  DISCOURSE_S3_BUCKET: xxx

```

它产生了以下错误：

```plaintext
/root` is not writable.
Bundler will use `/tmp/bundler20250409-1393-48ek5u1393' as your home directory temporarily.
Installing CORS rules...
Attempting to apply ASSETS S3 CORS ruleset in bucket biohacking-forum.
rake aborted!
Seahorse::Client::NetworkingError: Empty or incomplete response body (Seahorse::Client::NetworkingError)
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/aws-sdk-core-3.219.0/lib/seahorse/client/plugins/raise_response_errors.rb:17:in `call'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/aws-sdk-s3-1.182.0/lib/aws-sdk-s3/plugins/sse_cpk.rb:24:in `call'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/aws-sdk-s3-1.182.0/lib/aws-sdk-s3/plugins/dualstack.rb:21:in `call'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/aws-sdk-s3-1.182.0/lib/aws-sdk-s3/plugins/accelerate.rb:43:in `call'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/aws-sdk-core-3.219.0/lib/aws-sdk-core/plugins/checksum_algorithm.rb:169:in `call'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/aws-sdk-core-3.219.0/lib/aws-sdk-core/plugins/jsonvalue_converter.rb:16:in `call'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/aws-sdk-core-3.219.0/lib/aws-sdk-core/plugins/invocation_id.rb:16:in `call'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/aws-sdk-core-3.219.0/lib/aws-sdk-core/plugins/idempotency_token.rb:19:in `call'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/aws-sdk-core-3.219.0/lib/aws-sdk-core/plugins/param_converter.rb:26:in `call'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/aws-sdk-core-3.219.0/lib/seahorse/client/plugins/request_callback.rb:89:in `call'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/aws-sdk-core-3.219.0/lib/aws-sdk-core/plugins/response_paging.rb:12:in `call'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/aws-sdk-core-3.219.0/lib/seahorse/client/plugins/response_target.rb:24:in `call'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/aws-sdk-core-3.219.0/lib/aws-sdk-core/plugins/telemetry.rb:39:in `block in call'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/aws-sdk-core-3.219.0/lib/aws-sdk-core/telemetry/no_op.rb:29:in `in_span'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/aws-sdk-core-3.219.0/lib/aws-sdk-core/plugins/telemetry.rb:53:in `span_wrapper'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/aws-sdk-core-3.219.0/lib/aws-sdk-core/plugins/telemetry.rb:39:in `call'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/aws-sdk-core-3.219.0/lib/seahorse/client/request.rb:72:in `send_request'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/aws-sdk-s3-1.182.0/lib/aws-sdk-s3/client.rb:6359:in `get_bucket_cors'
/var/www/discourse/lib/s3_helper.rb:401:in `fetch_bucket_cors_rules'
/var/www/discourse/lib/s3_helper.rb:168:in `ensure_cors!'
/var/www/discourse/lib/s3_cors_rulesets.rb:60:in `sync'
/var/www/discourse/lib/tasks/s3.rake:183:in `block in <main>'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/rake-13.2.1/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 => s3:ensure_cors_rules
(See full trace by running task with --trace)

```
