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

    ImJasonH

    05/03/2022, 1:02 AM
    Is there a better way to test for its existence then?
  • j

    James

    05/03/2022, 1:02 AM
    try..catch the generic error is the general consensus right now I think
  • v

    Vitali

    05/03/2022, 1:28 AM
    Just a heads up that we're going to be rolling out transparent decompression this week to the S3 & APIv4 endpoints. What does this mean? https://cloud.google.com/storage/docs/transcoding Basically, if you have
    content-encoding: gzip
    and your request doesn't have
    accept-encoding: gzip
    , content gets decoded automatically unless
    cache-control
    has a value of
    no-transform
    . `cache-control`/`content-encoding` need not be set at upload time either - you can override
    cache-control
    (& any other predefined system metadata) when issuing the get request as per the S3 GetObject spec.
  • v

    Vitali

    05/03/2022, 1:30 AM
    This may break any of you that are using clients that don't send
    accept-encoding
    but are expecting the response back. We're eager for feedback if this breaks anyone. This does not impact Workers bindings because those run on your own zone. You are responsible for either decompressing it within the Worker (& getting billed for the wall time) or asking your customer support rep to turn
    gzip_respect_no_transform
    on for your zone to enable standard-conforming behavior on your zone (I'm not sure if workers.dev zones are candidates for this).
  • i

    ImJasonH

    05/03/2022, 1:30 AM
    That seems to be the problem, try/catch works. Thanks!
  • a

    andrew

    05/03/2022, 2:15 AM
    @Vitali hmm, how does this work with range requests?
  • a

    andrew

    05/03/2022, 2:16 AM
    i mean, if the object is
    content-encoding: gzip
    , the request doesn't have
    accept-encoding: gzip
    , and it specifies a range in the request, what happens?
  • a

    andrew

    05/03/2022, 2:20 AM
    ok, the GCS documentation mentions this. i assume R2 has the same behavior: > When transcoding occurs, if the request for the object includes a Range header, that header is silently ignored. This means that requests for partial content are not fulfilled, and the response instead serves the entire requested object.
  • v

    Vitali

    05/03/2022, 5:12 AM
    We should that’s right. It’s coming hot off the presses so we may have corner cases
  • v

    Vitali

    05/03/2022, 5:16 AM
    With the caveat that I think the correct behavior in these cases is to error rather than silently ignore the range request
  • a

    andrew

    05/03/2022, 6:31 AM
    just gzip, or also deflate?
  • a

    andrew

    05/03/2022, 6:32 AM
    it’s a cool feature so itd be interesting to eventually see some more exotic and higher speed compressors supported like lz4 and zstd
  • i

    itsmatteomanf

    05/03/2022, 7:38 AM
    Probably with Service Bindings, create a Worker that fetches from R2 and use it everywhere.
  • i

    itsmatteomanf

    05/03/2022, 11:24 AM
    With this one could hope for a global R2 binding, like all buckets at the same time and decide between them via path style…
  • l

    lmtr0

    05/03/2022, 2:00 PM
    @Vitali do you have time to check the logs to see if my client was authenticated?
  • v

    Vitali

    05/03/2022, 2:01 PM
    I don’t unfortunately. The error responses should be much clearer these days though. What’s the error?
  • v

    Vitali

    05/03/2022, 2:02 PM
    Whatever is supported by CF already
  • v

    Vitali

    05/03/2022, 2:03 PM
    We want that too but we want a better model that’s secure by default (eg you only get access to buckets you create/explicitly give access to your binding)
  • v

    Vitali

    05/03/2022, 2:04 PM
    We have the path based on as a hack for internal users because we don’t have anything else but we’re going to take that away from them once we have a replacement
  • l

    lmtr0

    05/03/2022, 2:10 PM
    here is the response I get:
    Copy code
    ====================
    [reqwest::connect][DEBUG] starting new connection: https://982723f0682411a61ffe979a716fd7e1.r2.cloudflarestorage.com/
    [reqwest::async_impl::client][DEBUG] response '400 Bad Request' for https://982723f0682411a61ffe979a716fd7e1.r2.cloudflarestorage.com/suite/file.json
    <html>
    <head><title>400 Bad Request</title></head>
    <body>
    <center><h1>400 Bad Request</h1></center>
    <hr><center>cloudflare</center>
    </body>
    </html>
    
    ====================
    [reqwest::connect][DEBUG] starting new connection: https://982723f0682411a61ffe979a716fd7e1.r2.cloudflarestorage.com/
    [reqwest::async_impl::client][DEBUG] response '400 Bad Request' for https://982723f0682411a61ffe979a716fd7e1.r2.cloudflarestorage.com/suite/file.json
    <html>
    <head><title>400 Bad Request</title></head>
    <body>
    <center><h1>400 Bad Request</h1></center>
    <hr><center>cloudflare</center>
    </body>
    </html>
  • l

    lmtr0

    05/03/2022, 2:10 PM
    I can try to get the headers if that would help....
  • e

    Erisa | Support Engineer

    05/03/2022, 2:17 PM
    For the reference of others, I tried this but it doesn't work because you can't do image resizing from a service binding fetch
  • v

    Vitali

    05/03/2022, 2:51 PM
    400 Bad Request
    is not an authorization issue
  • l

    lmtr0

    05/03/2022, 2:52 PM
    hmmmmmmm
  • l

    lmtr0

    05/03/2022, 2:53 PM
    Oh right 403 is auth issues
  • l

    lmtr0

    05/03/2022, 2:53 PM
    bruh
  • v

    Vitali

    05/03/2022, 2:53 PM
    I have logs running for prod now - if you retry I may be able to capture what you're seeing
  • l

    lmtr0

    05/03/2022, 2:53 PM
    ok
  • l

    lmtr0

    05/03/2022, 2:53 PM
    I will retry now
  • l

    lmtr0

    05/03/2022, 2:53 PM
    done
1...104105106...1050Latest