← 输入框|github.com|刷新
Skip to content

api: explain tls handshake failures when adding r2 buckets - #14

Merged
yekta merged 1 commit into
masterfrom
fix/r2-bucket-handshake-failure
Oct 17, 2026
Merged

yekta merged 1 commit into
masterfrom
fix/r2-bucket-handshake-failure

Conversation

@yekta

@yekta yekta commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Fixes UNB-371.

For the first few minutes after Cloudflare R2 is turned on, the account's endpoint can reject TLS handshakes because its certificate isn't being served yet. During that window, adding a bucket failed with a raw remote error: tls: handshake failure, and the same request worked a few minutes later. That's why it seemed to work on the third try.

  • mapS3Error now spots that exact TLS alert and returns an invalid-input error. The message tells the user to check the endpoint URL and, for a new R2 account, to try again shortly.
  • Other TLS alerts and connection errors still get the generic "Could not connect to the endpoint" message.
  • The S3 storage docs now mention the delay on new R2 accounts.

Tests

  • New: the handshake failure is mapped even when it's wrapped in an SDK retry error.
  • New: a different TLS alert still falls through to the generic message.
  • Updated: the existing URL error test now uses a plain connection-refused error.

A newly enabled Cloudflare R2 account can reject TLS handshakes for a few minutes while its endpoint certificate is not yet served. Adding a bucket then failed with a raw "remote error: tls: handshake failure", and retrying a little later worked.

That specific alert now maps to an invalid-input error. The error tells the user to check the endpoint URL and, for a new R2 account, to try again shortly. Other TLS alerts and connection errors still return the generic message. The S3 storage docs mention the delay too.
@yekta
yekta merged commit 4a2c105 into master Oct 17, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant