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

    flayks

    05/17/2023, 10:09 PM
    Awesome! That would just be for static videos, nothing fancy, HTML5 videos. Thanks ✌️
  • s

    Sourabh.Sashank

    05/18/2023, 7:17 AM

    https://pub-9c6706eacd0f4593bf740416e16b86be.r2.dev/Assets/BILLS/Expense-File-Name.jpg▾

    We uploaded an Image file through the api it got uploaded fine with sucess, but the file is not opening in browser any idea what may be reason of file getting curropted ? PBN_BUCKET.put(fileKey, request.body)
  • f

    flayks

    05/18/2023, 9:30 AM
    It works great! Thanks for your answers
  • Removing the slashes does not help
    s

    Siclude

    05/18/2023, 10:38 AM
    Removing the slashes does not help
    s
    b
    • 3
    • 31
  • l

    levifig

    05/18/2023, 12:36 PM
    having a weird issue where, if a file stored on R2 loads a JS or CSS file from another bucket, I get a MIME type mismatch (detects
    content/octet-stream
    but in reality it can be a JS or a CSS file), and this doesn't happen if pulling from the same bucket… Scratching my head over this! (⊙.☉)7
  • d

    digitalpoint

    05/18/2023, 5:37 PM
    If you're in the R2 dashboard, you are presented with a
    Manage R2 API Tokens
    button. Not all API tokens show up in there, only ones with the
    Account: Workers R2 Storage
    permission. However, editing an R2 API Token from the R2 dashboard wipes out all permissions for that token except for the R2 Storage permission. I have an app that is used by thousands of Cloudflare zones that uses 16 permissions (one of them being R2 Storage) and I keep running into an issue where a site loses the 15 other permissions they have for that token because they edited the token from the R2 dashboard. The latest was when a user simply wanted to add IP restrictions to his token and he lost all the other token permissions. See: https://xenforo.com/community/threads/digitalpoint-app-for-cloudflare%C2%AE.206176/post-1628890 It's not the first time this has happened (I'd say I've run into 8-10 support issues because of this at this point). Wouldn't it make more sense to either not delete the other API permissions on the token or make tokens that only have the R2 permission able to be edited from there?
  • s

    Sid | R2

    05/18/2023, 6:31 PM
    That definitely sounds like a bug. Let me try and repro and I’ll get this fixed
  • d

    digitalpoint

    05/18/2023, 6:33 PM
    Awesome… been a long-standing issue. I ran into it myself when I first started doing R2 development. Easy enough for me to work around (don’t edit tokens from there), but now that it’s becoming a support issue from my users it’s a little more annoying. 😀
  • k

    Karew

    05/18/2023, 6:53 PM
    Are you able to share URLs to the different files here?
  • s

    sathoro

    05/18/2023, 7:42 PM
    this happened when calling
    put
    . does this mean the client connected to the worker disconnected, or there was a network problem between the worker and R2? and if it means the client disconnected from the worker - why was the request outcome
    ok
    and not
    canceled
    ?

    https://cdn.discordapp.com/attachments/940663374377783388/1108842050767552593/image.png▾

  • u

    Unsmart | Tech debt

    05/18/2023, 7:43 PM
    I get that error sometimes as well its something internal and not the client connected to the worker disconnected.
  • u

    Unsmart | Tech debt

    05/18/2023, 7:44 PM
    At least in my case its always that, I assume that can possibly show up if the client connected to the worker disconnects (but that should show as cancelled also)
  • s

    sathoro

    05/18/2023, 7:44 PM
    interesting, okay guess I will add some retrying
  • s

    sathoro

    05/18/2023, 7:45 PM
    I'd love to see more automatic retrying when calling DOs, R2, etc
  • s

    sathoro

    05/18/2023, 7:45 PM
    or maybe in this case it could have actually been written
  • f

    Farhian

    05/18/2023, 8:31 PM
    Hi guys, I'm implementing a REST API using workers. I am getting CORS errors when testing it from a browser (it works when using Postman since that is not sending OPTIONS). Any idea where I could configure the CORS rules? thank you!
  • f

    flayks

    05/18/2023, 8:33 PM
    I get this error while fetching a video from localhost 🤔
    Copy code
    cess to fetch at 'https://assets.site.com/video.mp4' from origin 'http://localhost:5173' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
    My CORS rule:
    Copy code
    [
      {
        "AllowedOrigins": [
          "http://localhost:5173",
          "http://localhost:4173",
        ],
        "AllowedMethods": [
          "GET"
        ]
      }
    ]
  • f

    Farhian

    05/18/2023, 8:34 PM
    Where did you configure the rules?
  • f

    flayks

    05/18/2023, 8:34 PM
    in the r2 settings (CORS Policy)
  • f

    Farhian

    05/18/2023, 8:35 PM
    Do you know if workers have something similar? I am not able to find anything.
  • f

    flayks

    05/18/2023, 8:37 PM
    I'm not sure they do no 😬
  • f

    Farhian

    05/18/2023, 8:38 PM
    oh 😦
  • s

    Sid | R2

    05/18/2023, 8:50 PM
    If you’re writing your own Worker, you can just write out CORS headers yourself
  • f

    Farhian

    05/18/2023, 8:51 PM
    I am using itty-router and my CORS config is like this:
  • f

    Farhian

    05/18/2023, 8:51 PM

    https://cdn.discordapp.com/attachments/940663374377783388/1108859453123596380/image.png▾

  • f

    Farhian

    05/18/2023, 8:51 PM
    It fixed the issue locally, but not after I publish the worker
  • s

    Sid | R2

    05/18/2023, 8:52 PM
    What request are you sending out?
  • f

    Farhian

    05/18/2023, 8:52 PM
    POSTS
  • f

    Farhian

    05/18/2023, 8:52 PM
    well GET also
  • f

    Farhian

    05/18/2023, 8:52 PM
    GET works
1...103210331034...1050Latest