You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to access an r2 bucket from a vitedge function.
Cloudflare docs state that in order to access r2 bucket from a worker, it is necessary to bind worker to r2 bucket using the following syntax inside wrangler.toml
I want to access an r2 bucket from a vitedge function.
Cloudflare docs state that in order to access r2 bucket from a worker, it is necessary to bind worker to r2 bucket using the following syntax inside wrangler.toml
r2_buckets = [
{
binding = "BUCKET-1",
bucket_name = "bucket-1",
preview_bucket_name = "bucket-1"
},
{
binding = "BUCKET-2",
bucket_name = "bucket-2",
preview_bucket_name = "bucket-2"
}
]
and then, use that binding inside the worker as follows
const object = await env.Bucket1.get(objectName, ...)
however, in the above line env is undefined inside vitedge functions.
can you provide an example of how this binding variable can be accessed?
The text was updated successfully, but these errors were encountered: