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

    hudsantos

    05/09/2023, 8:07 PM
    Hi folks. Anyone reliably using s3fs to mount R2 as a filesystem? Even though R2 is compatible with S3, using s3fs seems not a good idea for mission critical production env. Or not? Would love to hear your thoughts on that. @Erisa | Support Engineer @Walshy | Pages
  • h

    hudsantos

    05/09/2023, 8:07 PM
    Thank you so much.
  • w

    Walshy | Pages

    05/09/2023, 8:07 PM
    No need to tag me or Erisa on that
  • e

    Erisa | Support Engineer

    05/09/2023, 8:07 PM
    Please don't mention individual employees for help
  • h

    hudsantos

    05/09/2023, 8:08 PM
    Oh ok sorry
  • k

    konga

    05/09/2023, 9:09 PM
    Does anyone know how to implement tus for R2 in a cloudflare worker?
  • k

    konga

    05/09/2023, 9:12 PM
    I've seen this https://github.com/Klowner/tussle/blob/main/examples/cloudflare-worker-r2/src/worker.ts Is there a simpler implementation?
  • h

    hudsantos

    05/09/2023, 10:25 PM
    Well, according to my own experiments, r2 being used with extraofficial
    s3fs-fuse
    to monut a bucket as a filesystem is really not recommended yet. It apparently mounts successfully, being allowed by token and by IP address, but some created files remains with 0B size. Also got many input/output errors. Tested this today within a very reliable Ubuntu 22.04.2 LTS - DigitalOcean droplet/network. Also after tests finished, I've housekeep the token successfully but could not delete the bucket itself. It says "Bucket cannot be deleted because it isn't empty". But the [Objects] tab says: "Your bucket is ready. Add files to get started." instead of list those objects so that I could delete them and then delete the bucket afterwards. We won't use R2 in production yet due to this mandatory aspect in our use case. Unfortunately it has to be available as a filesystem presented to the operating system. If anyone has a different/good experience with that combination in production I'd love to hear details. Thanks
  • c

    Chaika

    05/09/2023, 10:29 PM
    there's been some issues people have had with IP Address filtering, specifically with IPv6 I believe. Did you try it without an IP Address filter? I believe it should be pretty solid as long as the R2 S3-compat supports all of the APIs it uses
  • c

    Chaika

    05/09/2023, 10:30 PM
    Looks like one of the R2 Devs has used it in the past https://discord.com/channels/595317990191398933/940663374377783388/991859630525386883, assumingly without any real issue?
  • c

    Chaika

    05/09/2023, 10:33 PM
    (opps didn't ping on reply @hudsantos )
  • h

    hudsantos

    05/09/2023, 10:34 PM
    Nice.. I'll repeat the test but this time without filtering IP address. Hope that will help obtaining a better experience.
  • h

    hudsantos

    05/09/2023, 10:49 PM
    This will probably be more reliable/supported: https://rclone.org/commands/rclone_mount/ https://developers.cloudflare.com/r2/examples/rclone/ ..as mentiomed here https://discord.com/channels/595317990191398933/940663374377783388/991869365031014471
  • a

    Ammar

    05/09/2023, 11:16 PM
    Hi, can anyone guide me on how to debug my issue with rclone and r2? I have created a bucket via the cloudflare dashboard. I then walked through the rclone config to add r2 to as a remote. I am able to upload just fine. But any attempt to use
    ls
    lsf
    tree
    returns no results as if the bucket was empty. I am sure I tested this a few days ago and the list commands were working fine. I've tried creating a new bucket. But I am having the same issue. My api key has permissions
    Edit: Allow edit access of all objects and List, Write, and Delete operations of all buckets
  • h

    hudsantos

    05/10/2023, 12:36 AM
    That' weird Ammar
  • h

    hudsantos

    05/10/2023, 2:03 AM
    @Chaika it worked much better without the IPv4 filtering.. no idea why.. but thanks anyway.
  • c

    Chaika

    05/10/2023, 2:06 AM
    I believe there is some issue with how it filters IPv6s. Even if you whitelist your IPv6, it just doesn't work with it. RClone lets you specify an interface to use IPv4 which can work as well. One day I'll dig up enough information on it to report it, just don't have enough right now. rclone just silently fails, no errors or anything
  • i

    itsme

    05/10/2023, 5:09 AM
    hi sid i need your help. i messaged in "CORS" thread. but i dont know you will get notified or not because i am new to discord. so have a look in thread name "CORS".
  • a

    AlHill

    05/10/2023, 1:10 PM
    Hi, I'm making a worker which receives a R2 key and return signed URLs for create, read and delete items from a bucket. Although the code is almost the same, the delete signed URL doesn't work, it's created without problems, but it returns a 403 when accessing it. The R2 API token have edit permissions and the file which I'm trying to delete exists (and it has been uploaded with a signed URL of this worker)
    Copy code
    else if(route === "/getSignedURL" || route === "/getDeleteURL"){
                    const method = route === "/getDeleteURL" ? "DELETE" : "GET"
                    const { key } = await request.json()
                    console.log(key, method)
                    url.pathname = key
    
                    const { url: signedURL } = await r2.sign(
                        new Request(url, { method }),
                        { aws: { signQuery: true }}
                    )
    
                    if(!signedURL){
                        return new Response(JSON.stringify({ 
                            message: "Cannot get signed URL", 
                            code: 400 
                        }), { status: 400 })
                    } else {
                        return new Response(JSON.stringify({ signedURL }))
                    }
                }
  • a

    AlHill

    05/10/2023, 1:13 PM
    in fact, if I access this same code by /getSignedURL, the returning URL works just fine
  • s

    Sid | R2

    05/10/2023, 1:17 PM
    Is the
    r2.sign
    function from
    aws4fetch
    ? If so, does surrounding the
    r2.sign
    in a
    try/catch
    show you what the problem was?
  • a

    AlHill

    05/10/2023, 1:20 PM
    @Sid | R2 Yes, aws4fetch. The try/catch doesn't do anything, it doesn't fails.
  • I mean the code is working it returns a
    a

    AlHill

    05/10/2023, 1:21 PM
    I mean, the code ""is working"", it returns a signed URL which seems to be invalid
    s
    • 2
    • 1
  • a

    AlHill

    05/10/2023, 1:32 PM
    I have found this old SO thread which seems to say that presigned URL for delete operations are not supported... but is pretty old, haha https://stackoverflow.com/questions/48216365/generate-presigned-s3-url-for-delete-operation
  • k

    kian

    05/10/2023, 1:35 PM
    It should work fine
  • a

    AlHill

    05/10/2023, 1:38 PM
    I would love it, haha
  • a

    AlHill

    05/10/2023, 1:39 PM
    BTW, the error which raises accessing the generated URL is this one
    Copy code
    <Error>
    <Code>SignatureDoesNotMatch</Code>
    <Message>The request signature we calculated does not match the signature you provided. Check your secret access key and signing method. </Message>
    </Error>
  • a

    AlHill

    05/10/2023, 2:08 PM
    I have been messing with aws4fetch inner code, searching any clues, but no luck
  • k

    kian

    05/10/2023, 2:13 PM
    The error is usually as good as it gets - the signature just doesn't match
  • k

    kian

    05/10/2023, 2:13 PM
    Your request vs what was signed don't match up
1...101510161017...1050Latest