Skip to content

[Bug]: cloudflare-r2 storage provider ignores custom endpoint, breaking EU jurisdiction R2 buckets #14847

Description

@remihuigen

What happened?

Summary

When AFFiNE storage is configured with provider: "cloudflare-r2", a custom config.endpoint is ignored.
The provider always uses https://<accountId>.r2.cloudflarestorage.com, which breaks uploads for jurisdictional buckets (for example EU) that require a jurisdiction endpoint like https://<accountId>.eu.r2.cloudflarestorage.com.

Current behavior

With config like:

{
  "provider": "cloudflare-r2",
  "bucket": "affine",
  "config": {
    "accountId": "<account-id>",
    "endpoint": "https://<account-id>.eu.r2.cloudflarestorage.com",
    "region": "auto",
    "credentials": {
      "accessKeyId": "...",
      "secretAccessKey": "..."
    }
  }
}

AFFiNE still signs/sends requests to the global endpoint and uploads fail with 403 AccessDenied for EU jurisdiction buckets.

Expected behavior

If config.endpoint is provided for cloudflare-r2, AFFiNE should use it (while keeping path-style addressing).
Fallback to https://<accountId>.r2.cloudflarestorage.com only when endpoint is not set.

References

Distribution version

macOS x64 (Intel)

App Version

No response

What browsers are you seeing the problem on if you're using web version?

No response

Are you self-hosting?

  • Yes

Self-hosting Version

v0.26.6

Relevant log output

Anything else?

No response

Is your content generated by AI?

  • I confirm that the content I submitted was not generated by AI / merely contained minimal AI edits.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    🆕 *Untriaged

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions