Rumon
Rumon
Explore posts from servers
CDCloudflare Developers
Created by Rumon on 9/14/2024 in #general-help
Defining R2 Binding in wrangler.toml
Hi, I have an R2 bucket at EU named "foo". The corresponding S3 URL is like https://account_id.eu.r2.cloudflarestorage.com/foo. In my Workers project's wrangler.toml file, I've added it like:
[[r2_buckets]]
binding = "APP_BUCKET"
bucket_name = "foo"
[[r2_buckets]]
binding = "APP_BUCKET"
bucket_name = "foo"
And I've set up GitHub Actions to deploy my Workers. Below is the config:
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
But it doesn't succeed. I get the following error in the runner:
/usr/local/bin/npx wrangler deploy
⛅️ wrangler 3.13.2 (update available 3.78.2)
---------------------------------------------
Your worker has access to the following bindings:
- R2 Buckets:
- APP_BUCKET: foo
Total Upload: 1.72 KiB / gzip: 0.72 KiB

✘ [ERROR] A request to the Cloudflare API (/accounts/***/workers/scripts/foo) failed.

workers.api.error.bucket_not_found [code: 10085]

If you think this is a bug, please open an issue at: https://github.com/cloudflare/workers-sdk/issues/new/choose
/usr/local/bin/npx wrangler deploy
⛅️ wrangler 3.13.2 (update available 3.78.2)
---------------------------------------------
Your worker has access to the following bindings:
- R2 Buckets:
- APP_BUCKET: foo
Total Upload: 1.72 KiB / gzip: 0.72 KiB

✘ [ERROR] A request to the Cloudflare API (/accounts/***/workers/scripts/foo) failed.

workers.api.error.bucket_not_found [code: 10085]

If you think this is a bug, please open an issue at: https://github.com/cloudflare/workers-sdk/issues/new/choose
The API token being used has the following permissions:
This API token will affect the below accounts and zones, along with their respective permissions


<Account Name> - Cloudflare Pages:Edit, Workers R2 Storage:Edit, Workers Tail:Read, Workers KV Storage:Edit, Workers Scripts:Edit, Account Settings:Read
All zones - Workers Routes:Edit
All users - Memberships:Read, User Details:Read
This API token will affect the below accounts and zones, along with their respective permissions


<Account Name> - Cloudflare Pages:Edit, Workers R2 Storage:Edit, Workers Tail:Read, Workers KV Storage:Edit, Workers Scripts:Edit, Account Settings:Read
All zones - Workers Routes:Edit
All users - Memberships:Read, User Details:Read
Can anyone help me out on this?
foo is just a dummy name. I'm using the actual name which is shown in the website (and also in the S3 URL).
2 replies