https://discord.cloudflare.com logo
Join Discord
Powered by
# r2
  • c

    chientrm

    03/08/2023, 2:09 AM
    nice and clean, uploading speed
    80MB/s
  • s

    Sid | R2

    03/08/2023, 2:16 AM
    Yep ListObjectsV2 (or .list in a Worker) is the way to go. Performance should not be a concern, we will only scan through a subset of the bucket, and return up to 1000 items at a time, so the total number of objects in the bucket isn’t a huge factor.
  • c

    chientrm

    03/08/2023, 2:29 AM
    I got my domain connected and active to a r2 bucket.
  • c

    chientrm

    03/08/2023, 2:30 AM
    But the public url access is
    Not allowed
  • c

    chientrm

    03/08/2023, 2:32 AM
  • c

    chientrm

    03/08/2023, 2:33 AM
    Oh cuz there's not an
    index.html
  • c

    Chaika

    03/08/2023, 2:44 AM
    R2 doesn't redirect to index.html for you ex. does work if you manually go to it You have to create a Transform Rule Rewrite URL if you want it to do that. Here's how: https://discord.com/channels/595317990191398933/940663374377783388/1078368601683275806
  • c

    chientrm

    03/08/2023, 2:48 AM
    yep. works as intended.
  • c

    chientrm

    03/08/2023, 2:49 AM
    would be nice if I can quickly edit
    index.html
    on R2 web.
  • m

    mudassir

    03/08/2023, 7:20 AM
    while uploading object to
    R2 storage
    can we get the public url of uploaded object.. if yes then how?
  • c

    chientrm

    03/08/2023, 7:21 AM
    add your subdomain or use the
    r2
    public domain.
  • c

    chientrm

    03/08/2023, 7:21 AM
    in Bucket -> tab Settings.
  • m

    mudassir

    03/08/2023, 7:22 AM
    great, if we are using
    wrangler cli
    .. in that case, we just get a message
    upload complete
    .. if we need a public url of object in response?
  • c

    chientrm

    03/08/2023, 7:23 AM
    just concat your domain with the object name 🙂
  • m

    mudassir

    03/08/2023, 7:24 AM
    nice, got it. thank you
  • k

    knpwrs

    03/08/2023, 4:52 PM
    I have terraform working for creating and configuring an r2 bucket as such:
    Copy code
    terraform {
      required_providers {
        aws = {
          source  = "hashicorp/aws"
          version = "4.57.1"
        }
      }
    }
    
    provider "aws" {
      alias                       = "cloudflare"
      region                      = "us-east-1"
      access_key                  = var.cloudflare_r2_access_key
      secret_key                  = var.cloudflare_r2_secret_key
      skip_credentials_validation = true
      skip_region_validation      = true
      skip_requesting_account_id  = true
    
      endpoints {
        s3 = var.cloudflare_r2_endpoint
      }
    }
    
    resource "aws_s3_bucket" "public_bucket" {
      provider = aws.cloudflare
      bucket   = var.cloudflare_r2_public_bucket
    }
    
    resource "aws_s3_bucket_cors_configuration" "public_bucket_cors" {
      provider = aws.cloudflare
      bucket   = aws_s3_bucket.public_bucket.id
    
      cors_rule {
        allowed_methods = ["GET"]
        allowed_origins = ["*"]
      }
    }
    All of that works, but when I try to configure the ACL with the following:
    Copy code
    resource "aws_s3_bucket_acl" "public_bucket_acl" {
      provider = aws.cloudflare
      bucket   = aws_s3_bucket.public_bucket.id
      acl      = "public-read"
    }
    I get the following error:
    Copy code
    │ Error: error creating S3 bucket ACL for public-bucket: NotImplemented: PutBucketAcl not implemented
    │       status code: 501, request id: , host id:
    │
    │   with aws_s3_bucket_acl.public_bucket_acl,
    │   on main.tf line 128, in resource "aws_s3_bucket_acl" "public_bucket_acl":
    │  128: resource "aws_s3_bucket_acl" "public_bucket_acl" {
    This makes sense, but now I'm wondering: is there any way to enable "Public URL Access" through terraform, or do I have to use the web console after the bucket is created?
    s
    c
    j
    • 4
    • 58
  • g

    giviz

    03/08/2023, 5:05 PM
    Hey guys, I have 2 domains in my account, domain.dev and domain.com and I’m adding both as custom domain on an R2 bucket. For .dev I had no issue, It works like a charm. But for .com, the status stays at “unknown” with an error 1014. I can see the R2 CNAME added on the domain DNS, and I tried to use that domain with several buckets and different subdomains string but all are locked in that non working state. What am I missing here ? Thanks !
  • w

    wot

    03/08/2023, 5:13 PM
    Any idea if ListParts is on the roadmap? https://developers.cloudflare.com/r2/data-access/s3-api/api/#unimplemented-object-level-operations
  • k

    kian

    03/08/2023, 5:17 PM
    Yep
  • s

    Sid | R2

    03/08/2023, 5:22 PM
    What is the domain in question?
  • g

    giviz

    03/08/2023, 5:22 PM
    can I send it by MP ?
  • s

    Sid | R2

    03/08/2023, 5:22 PM
    Sure
  • s

    Sid | R2

    03/08/2023, 5:37 PM
    You have no idea how close you are to getting it 😄
  • s

    Scheggia

    03/08/2023, 6:26 PM
    I searched the channel but see many different answers. Can I upload my videos to R2 and then post the link on discord? only for this, not on websites but only to share them on discord. is this somehow against ToS or do I risk the video/account being suspended?
  • k

    kian

    03/08/2023, 6:27 PM
    Look at the latest pinned message - it's fine
  • a

    azurebarry

    03/08/2023, 8:11 PM
    I would love to use R2 for a large project. However, I will need to be able to create public buckets with the API. This isn’t available at the moment. Is this on the roadmap? If so, when is this expected to roll out?
  • w

    wot

    03/08/2023, 9:33 PM
    Can you share an eta?
  • s

    silentdevnull

    03/09/2023, 12:05 AM
    Do you know of any basic code examples. I have been having a hard time getting this to work (sorry for replying to an older post. ).
  • j

    James

    03/09/2023, 12:05 AM
    Can you share some code that you've tried and any issues/errors you've run into?
  • s

    silentdevnull

    03/09/2023, 12:12 AM
    This is the code I put together. It will never even start up when I try to do wrangler dev.
    Copy code
    import render from "render2";
    export interface Env {
        MY_BUCKET: 'mydevstorage';
    }
    
    export default {
        async fetch(
            request: Request,
            env: Env,
            ctx: ExecutionContext
        ): Promise<Response> {
            return render.fetch(request, env, ctx);
        },
    };
    I'm still working on learning the whole how workers work.
1...935936937...1050Latest