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

    ucinteractivesl

    04/11/2023, 9:54 PM
    Sure
  • u

    ucinteractivesl

    04/11/2023, 9:54 PM
    We are not there yet
  • u

    Unsmart | Tech debt

    04/11/2023, 9:55 PM
    Sure but you can always contact sales to see if the pricing they give would be too much or not for your use case, doesnt mean you have to upgrade to enterprise 🙂
  • u

    ucinteractivesl

    04/11/2023, 9:56 PM
    Enterpise is around $200 a month as I remember?
  • k

    kian

    04/11/2023, 9:56 PM
    15x that at a minimum
  • k

    kian

    04/11/2023, 9:56 PM
    $200 is Business
  • u

    Unsmart | Tech debt

    04/11/2023, 9:56 PM
    It starts at like $2000-5000
  • u

    ucinteractivesl

    04/11/2023, 9:56 PM
    Oh no, that´s business, enterprise is custom
  • s

    SKRRRTT

    04/12/2023, 6:36 AM
    Just made the switch from wasabi to R2 and man I wish I switched sooner
  • s

    SKRRRTT

    04/12/2023, 6:36 AM
    R2 is so much nicer and MILES faster
  • s

    SKRRRTT

    04/12/2023, 6:36 AM
    ❤️
  • s

    SKRRRTT

    04/12/2023, 6:37 AM
    left wasabi with a nice little message before I wiped my account https://cdn.aiden.gg/files/ⓟⓡⓞⓐⓦⓞⓩⓘ‎
  • m

    Mike - Dev

    04/12/2023, 6:49 AM
    Haha nice 😎
  • o

    oldmanmeta

    04/12/2023, 7:27 AM
    hi - I'm getting a fetch error when using the aws sdk v3 lib in typescrypt to upload a file to R2. The error is CORS related.
    Copy code
    localhost/:1 Access to fetch at 'https://buketname--->.r2.cloudflarestorage.com/testKeyName?x-id=PutObject' from origin 'http://localhost:8080' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: 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.
    I've got a valid API key running on this bucket - not 100% how I can fix this as the AWS SDK is pretty closed off in terms of an interface This is the call that I am making:
    Copy code
    const command = new PutObjectCommand({
                Bucket: bucketName,
                Key: bucketKeyName,//The name of the object
                Body: fileItem,
            });
  • h

    HardAtWork

    04/12/2023, 7:30 AM
    Are you putting your API Token in the frontend?
  • o

    oldmanmeta

    04/12/2023, 7:32 AM
    Thanks for the response. Yeah, that's all done with the initialisation of the S3Client - exactly as writing in the cloudflare docs
  • o

    oldmanmeta

    04/12/2023, 7:33 AM
    https://developers.cloudflare.com/r2/examples/aws/aws-sdk-js-v3/
  • h

    HardAtWork

    04/12/2023, 7:34 AM
    That code, while not explicitly written as such, is meant to be run server-side, both to not require CORS to function, but also because you shouldn't leave your API token in your frontend for anyone to use/abuse.
  • o

    oldmanmeta

    04/12/2023, 7:35 AM
    That goes without saying. But this is for a quick bit of prototyping and so generally, we smash this out in a simple app. CORS should not be causing this much issue, especially with a created API key
  • k

    kian

    04/12/2023, 7:36 AM
    You just need to setup a CORS policy on your bucket
  • k

    kian

    04/12/2023, 7:36 AM
    S3 would/should be the exact same
  • k

    kian

    04/12/2023, 7:36 AM
    There's no default CORS setup
  • o

    oldmanmeta

    04/12/2023, 7:39 AM
    @kian - Thanks for reminding me of that. There is a CORS policy on the specific bucket from before - but it reminded me of no PUT method on it. Still getting a fail - is a time delay until it's updated?
  • k

    kian

    04/12/2023, 7:40 AM
    I haven't experienced one personally but people have mentioned here now & then that it took awhile to propagate
  • o

    oldmanmeta

    04/12/2023, 7:40 AM
  • o

    oldmanmeta

    04/12/2023, 7:41 AM
    @kian @HardAtWork - thanks for the help. Will keep an eye on this over the next 30 mins and let you know if I'm still bleeding from my nose at that point. Cheers
  • k

    kian

    04/12/2023, 7:42 AM
    Only other note is that if you're uploading with a
    Content-Type
    that isn't `text/plain`/`application/json`, then you'll want to add that into Allowed Headers
  • k

    kian

    04/12/2023, 7:42 AM
    Very few values are CORS safelisted for that header
  • o

    oldmanmeta

    04/12/2023, 7:43 AM
    I was trying to add a multipart-form-data file at first and wondered if that was causing the issue. I switch back to a JSON object just to test it out, and its the same response. What is the best practice for uploading a multipart file such as a large model file?
  • k

    kian

    04/12/2023, 7:44 AM
    Personally, any library intended for it - because if you use an AWS SDK, you're managing state and every operation yourself
1...986987988...1050Latest