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

    wot

    03/07/2023, 3:34 AM
    Getting a very vague error trying to complete multipart uploads in a worker:
    completeMultipartUpload: There was a problem with the multipart upload. (10048)
    . Any ideas? I am passing all the parts.
  • c

    crashing-waves

    03/07/2023, 11:33 AM
    Can someone point me to a step by step guide on how to mock R2 for local development? I have no idea what I am doing here Tried using wrangler in local mode
    Copy code
    npx wrangler pages dev --persist-to wrangler-local-state/ --local -- npm start
    created
    Copy code
    wrangler-local-state/r2/bucket_name
    and added a binding to
    Copy code
    .toml
    but fetching a key from R2 is still returning null
  • r

    rodbs

    03/07/2023, 11:38 AM
    Same thing here. I cannot find nice examples to set up locally and then replicate it online
  • k

    kian

    03/07/2023, 11:39 AM
    --r2=BUCKET
    is needed too
  • k

    kian

    03/07/2023, 11:39 AM
    Or well, is preferred -
    pages dev
    shouldn't read from
    wrangler.toml
    if it is
  • h

    HardAtWork

    03/07/2023, 11:43 AM
    That one isn’t documented lol
  • k

    kian

    03/07/2023, 11:45 AM
    nothing new there :^)
  • c

    crashing-waves

    03/07/2023, 11:48 AM
    so if my .toml file is
    Copy code
    r2_buckets  = [
      { binding = "FEATHERS", bucket_name = "feathers", preview_bucket_name = "feathers-preview"}
    ]
    Do I need
    Copy code
    --r2==FEATHERS
    or
    Copy code
    --r2==feathers
    ?
  • s

    Skye

    03/07/2023, 11:52 AM
    --r2=FEATHERS
  • s

    Skye

    03/07/2023, 11:52 AM
    or --r2 FEATHERS, it's not fussy
  • c

    crashing-waves

    03/07/2023, 11:59 AM
    Alright, thanks guys!!
  • e

    elithrar

    03/07/2023, 12:13 PM
    https://developers.cloudflare.com/pages/platform/functions/bindings/#interact-with-your-r2-buckets-locally
  • a

    Advany

    03/07/2023, 12:15 PM
    Local development uses local storage. It cannot access data stored on Cloudflare’s servers. By default, data in local development is not persisted. This means if you write a value into KV, for example, the next time you start local dev, it will no longer exist. Enable persistence with the --persist flag.
  • a

    Advany

    03/07/2023, 12:15 PM
    anyway to bind to the cloudflare servers?
  • e

    Erisa | Support Engineer

    03/07/2023, 12:16 PM
    Remote data will be used if you use
    wrangler dev
    in remote mode (the default)
  • e

    Erisa | Support Engineer

    03/07/2023, 12:16 PM
    You can specify preview buckets/namespaces in your
    wrangler.toml
    file
  • e

    elithrar

    03/07/2023, 12:21 PM
    and/or via https://developers.cloudflare.com/pages/platform/functions/bindings/#r2-buckets
  • a

    Advany

    03/07/2023, 12:43 PM
    wrangler dev is great! Is there an alternative to it for a pages project that will also work in remote mode?
  • r

    rodbs

    03/07/2023, 12:46 PM
    It doesn't work for me. Anyhow, why do you need
    --persist-to wrangler-local-state
    when
    --persist
    already creates the folder
    .wrangler\state
    . My issue is that I can create an object in
    .wrangler\state\R2 ..
    using just the
    --persist
    flag, but I cannot read it!
  • e

    Erisa | Support Engineer

    03/07/2023, 12:47 PM
    Unfortunately not,
    wrangler pages dev
    only supports local mode at the moment
  • a

    Advany

    03/07/2023, 12:54 PM
    also not possible to run pages in "production" mode or something right?
  • h

    HardAtWork

    03/07/2023, 12:56 PM
    Not without publishing, no
  • h

    HardAtWork

    03/07/2023, 12:57 PM
    Because it requires you to upload all of your assets, you might as well be deploying it
  • a

    Advany

    03/07/2023, 1:14 PM
    Ok. Got it 🙂
  • w

    wot

    03/07/2023, 1:47 PM
    Just following up on this, I've observed it working when I try smaller files that only take 1-3 parts, but larger ones (19 parts) fail when trying to complete. Is there a limit I'm not aware of? The larger file is 183MB.
  • s

    Sid | R2

    03/07/2023, 2:06 PM
    Are all your parts the same size (except the last one, which may be smaller)?
  • s

    Sid | R2

    03/07/2023, 2:07 PM
    The limit for file sizes in multipart uploads is 5TB, and individual parts should be >5MB
  • w

    wot

    03/07/2023, 2:13 PM
    Oo that might be the issue. The smaller files are getting chunked evenly but the larger seems to be sending very slightly different sizes.
  • r

    rodbs

    03/07/2023, 3:50 PM
    Hi, Could anyone explain how to configure R2 to work locally? Do we need the
    --persist-to wrangler-local-state
    ? why
    --persist
    is not enough (like for KV) ? With KV I have not issues writing and reading locally, but with R2 I cannot read, I always get an empty body
  • m

    Moritz S

    03/07/2023, 4:07 PM
    We want to host a .json file for each user of our application in R2. However the loading time is very bad: 150-300ms (first load 500+ms) just to load the file directly in the browser (we tested it from multiple locations). If we host the same File for example in Shopify Assets (Shopify CDN) its only 30-80ms. Does R2 not have CDN? Do we have to activate it separately? The R2 domain is proxied via cloudflare DNS
1...933934935...1050Latest