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

    jessec

    05/04/2023, 8:04 PM
    Can you use the same bucket name in
    preview_bucket_name
    ? Trying to get local dev working for this worker, but I don't want to duplicate my files into a separate bucket.
  • k

    kian

    05/04/2023, 8:04 PM
    Yep
  • e

    Erisa | Support Engineer

    05/04/2023, 8:04 PM
    Yeah, you can use the same bucket
  • e

    Erisa | Support Engineer

    05/04/2023, 8:05 PM
    I think theres a warning that recommends you not to (or maybe that was just KV), but if thats what you want you can just ignore it
  • j

    jessec

    05/04/2023, 8:43 PM
    So it works as far as running the command, but it doesn't seem like it has access to the actual files in the bucket.
  • j

    jessec

    05/04/2023, 8:47 PM
    npx wrangler dev 'backend/src/app.ts' --experimental-local --compatibility-flags='nodejs_compat'
  • j

    jessec

    05/04/2023, 8:49 PM
  • k

    kian

    05/04/2023, 8:49 PM
    Looks like you're using
    --local
    or
    --experimental-local
    there since it says Miniflare
  • k

    kian

    05/04/2023, 8:49 PM
    Oh yeah, you are
  • k

    kian

    05/04/2023, 8:49 PM
    Only normal
    dev
    is remote with access to the 'real' bucket
  • j

    jessec

    05/04/2023, 8:50 PM
    but it says only nodejs_compat works with experimental-local lol
  • k

    kian

    05/04/2023, 8:50 PM
    Works in production fine
  • k

    kian

    05/04/2023, 8:50 PM
    Just not
    --local
  • j

    jessec

    05/04/2023, 8:51 PM
    I can't debug in production
  • k

    kian

    05/04/2023, 8:51 PM
    So just remove
    --experimental-local
    ?
  • k

    kian

    05/04/2023, 8:51 PM
    Like I said,
    dev
    by default is remote
  • j

    jessec

    05/04/2023, 8:59 PM
    Thanks, that worked, I was under the impression that was required for nodejs_compat to work.
  • f

    fossfighter

    05/04/2023, 9:39 PM
    Hi, need help with setting up subdomain for R2. I purchased domain and I can set it for R2, but I want R2 to be on a subdomain. To do it, I must create subdomain first. But for subdomain creation I must provide IPv4 address. So how to do it?
  • c

    Chaika

    05/04/2023, 9:46 PM
    It'll create the necessary DNS Record for you when you connect the domain in your bucket's settings
  • f

    fossfighter

    05/04/2023, 9:49 PM
    When I'm trying to connect new subdomain I'm getting "That domain was not found on your account."
  • c

    Chaika

    05/04/2023, 9:50 PM
    Double check your input? What's the domain you are trying to connect?
  • c

    Chaika

    05/04/2023, 9:52 PM
    (It has to be a domain/zone active in the same account)
  • f

    fossfighter

    05/04/2023, 9:53 PM
    Oh wow for regular domain I'm getting same message UPD somehow it just worked after next try
  • i

    iway1

    05/05/2023, 2:42 AM
    anyone know how to deal with CORS errors from R2 when using
    fetch
    for
    GET
    request with presigned url? Getting
    No 'Access-Control-Allow-Origin' header is present on the requested resource.
    I've tried all the stuff from https://developers.cloudflare.com/r2/buckets/cors/ and https://community.cloudflare.com/t/problem-with-settings-cors-policies-on-r2/432339... Settings are:
    Copy code
    [
      {
        "AllowedOrigins": [
          "http://localhost:3000"
        ],
        "AllowedMethods": [
          "GET",
          "PUT",
          "HEAD"
        ],
        "ExposeHeaders": [
          "*"
        ],
        "MaxAgeSeconds": 2
      }
    ]
  • k

    Karew

    05/05/2023, 2:47 AM
    Is your fetch request setting an
    Origin
    header?
  • i

    iway1

    05/05/2023, 2:52 AM
    Origin
    header cannot be set programmatically in javascript
  • i

    iway1

    05/05/2023, 3:12 AM
    it's even more confusing because sometimes it does return the correct headers some times it does not, with identical fetch calls
  • k

    Karew

    05/05/2023, 3:15 AM
    Clear your Cloudflare caches, perhaps
  • k

    Karew

    05/05/2023, 3:15 AM
    If it's happening sometimes
  • i

    iway1

    05/05/2023, 3:54 AM
    alright I'm pretty sure it's related to the fact that I'm rendering some image in an
    <img/>
    tag and also fetching that same image with
    fetch
    , and theres some weird browser side caching going on that makes it where when the
    fetch
    resolves it doesn't have the desired CORS header... this must be the case because if I generate a second presigned url that doesn't appear in any
    <img/>
    i don't get the CORS issue, nor do i see the issue if I try the same fetch from a different browser, also is fixed if I don't render an
    <img/>
    with that src IDK if this has anything to do with R2, i think it's just something chrome is doing. 🥲
1...101010111012...1050Latest