How to access R2 buckets with jurisdiction from CF Pages?
Hi, I'm using Cloudflare Pages and R2 Buckets with Jurisdiction EU. I can access the buckets from Workers (when adding the jurisdiction to the binding in the toml file), but that does not work for the pages project as those bindings can only be configured via the UI / dashboard. There, the buckets don't appear. Any idea what to do? Thanks in advance.
12 Replies
When you make a bucket you can define a jurisdiction. Then you should be able to just bind it and use it as normal within Pages
Yes, I did specify the jurisdiction when creating the bucket. However, I cannot add it in the UI. Those buckets don't appear, instead I only get this:
Get Started links to the R2 Overview Page where I can see all the buckets.
When creating a Bucket without jurisdiction, I can add the binding...
But not for Buckets with jurisdiction.
I see, ok so the jurisdiction seems required by the binding - https://developers.cloudflare.com/r2/reference/data-location/#using-jurisdictions-from-workers
and seems like the UI needs an update too to show these
I'll cut a ticket but likely won't be able to get to this super quickly
for my own ref: WC-2034
Ok, thanks!
Is there any workaround? As far as I know I can't change the jurisdiction of existing buckets and using the cli / toml only works for workers, not for pages. Right?
I tried using the API and noticed some very strange things. I used the following request:
PATCH https://api.cloudflare.com/client/v4/accounts/MY_ACCOUNT_ID/pages/projects/MY_PROJECT
Auth Header + Content Type application/json
body:
What happens is the following:
- the API does not do any validation whatsoever. I can use
"name": "non-existing-bucket"
and that bucket appears in the UI (see in the screenshot).
- Buckets with Jurisdiction also appear there, but they cannot be clicked on (the URL which the link redirects to ends with /r2/default/buckets/[bucketname] instead of /r2/eu/buckets/[bucketname]
- adding a "jurisdiction"
key to the json body of the api request does not change anything.And - is there anywhere I can track the progress of this ticket? Thanks in advance!
yeah this is expected, the pages system is different from where the normal bindings live (workers service). The validation therefore is on upload
It's an internal ticket so no sorry
OK, thanks anyway! I guess I monitor the changelog.
Just noticed another bug there (this time with workers, where it works with the .toml file):
The UI ist still broken for that and when I try to add secrets, I get "bucket not found". Seems like when I press "Deploy" in the
Environment Variables
section, it also tries to update r2 bucket bindings?
That's quite a bummer...