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

    denchi

    04/13/2023, 10:24 PM
    oh cool, i just noticed the location hints are now available on the R2 bucket creation UI
  • d

    denchi

    04/13/2023, 10:24 PM
    that's awesome
  • d

    denchi

    04/13/2023, 10:33 PM
    would be nice to have the region visible somewhere on the UI after creation too
  • d

    DBlessDev.eth

    04/13/2023, 11:18 PM
    Has anyone has success getting r2 buckets to work locally with NextJS?
  • R2 <> NextJS
    d

    DBlessDev.eth

    04/13/2023, 11:18 PM
    I can get the bucket configured to my proccess.env however it says all the objects are empty. Also, the bucket is working on my production build.
    s
    • 2
    • 14
  • d

    DBlessDev.eth

    04/13/2023, 11:19 PM
    I've configured my
    wrangler.toml
    and tried the
    npx wrangler pages dev .vercel/output/static --compatibility-date=2023-04-13
    w/wo --r2=BUCKET_NAME. Does the BUCKET_NAME need to be the binding variables or the bucket name, cus I tried both and neither worked.
  • d

    DBlessDev.eth

    04/13/2023, 11:21 PM
  • d

    DBlessDev.eth

    04/13/2023, 11:21 PM
    Not sure what's going on ehre
  • d

    DBlessDev.eth

    04/13/2023, 11:21 PM
    Copy code
    [[r2_buckets]]
    binding="CRYPTO_NOTIFICATIONS"
    bucket_name="cryptocurrency-notifications"
    preview_bucket_name="dv-cn"
    Here's my wrangler.toml
  • d

    DBlessDev.eth

    04/13/2023, 11:22 PM
    Copy code
    import type { NextRequest } from 'next/server';
    
    export const config = {
      runtime: 'edge',
    };
    
    // Fix process type, declare it as any type
    declare const process: any;
    
    export default async function onRequest(context: any): Promise<any> {
      try {
        const bucket = process.env.CRYPTO_NOTIFICATIONS;
        const obj = await process.env.CRYPTO_NOTIFICATIONS.get('gainers.csv');
        if (obj === null) {
          return new Response('Not found', { status: 404 });
        }
        return new Response(obj.body);
      } catch (e: any) {
        return new Response(e.message);
      }
    }
    Here's my getBucket test api. Is it because it's the runtime edge?
  • h

    heartz

    04/14/2023, 3:25 PM
    hey, my application randomly started receiving a hour ago "Unauthorized: Unauthorized" - has cloudflare changed something by any chance?
  • g

    gotfredsen

    04/14/2023, 3:39 PM
    I updated a pdf on r2 storage that has same file name but it still shows old file ???
  • g

    gotfredsen

    04/14/2023, 3:39 PM
    is there some hidden cache on r2 that I need to reset
  • o

    O Rato

    04/14/2023, 3:42 PM
    if you are using a custom domain for public bucket access it caches your content, you will either have to purge the cache for the file, change file name or use a signed url to the file
  • g

    gotfredsen

    04/14/2023, 3:42 PM
    hmm purge cache seems to solve it .. strange for an r2 .. thanks its solved now 🙂
  • s

    Sid | R2

    04/14/2023, 4:19 PM
    We haven’t pushed anything out recently, maybe your API token expired?
  • s

    Sid | R2

    04/14/2023, 4:20 PM
    So to be clear, R2 is always strongly consistent (and you can count on this), but since your custom domain puts a cache on top, your new file’s request doesn’t ever reach R2, so you serve the old one. A cache purge is the right “fix” for this.
  • s

    shakti150

    04/15/2023, 6:42 AM
    Delete objects from R2 bucket older than a date?
  • s

    Sid | R2

    04/15/2023, 6:49 AM
    You can set up lifecycle rules via the S3 API. UI is also coming soon!
  • s

    shakti150

    04/15/2023, 6:50 AM
    any docs available?
  • s

    Sid | R2

    04/15/2023, 6:51 AM
    https://developers.cloudflare.com/r2/buckets/object-lifecycles/
  • t

    TubbyStubby2

    04/15/2023, 6:55 AM
    Hi I was just exploring r2 had a question, is it possible to use same custom domain for multiple buckets?
  • k

    Karew

    04/15/2023, 7:24 AM
    Yes but each bucket will need its own subdomain
  • c

    chientrm

    04/15/2023, 7:37 AM
    According to this guide, presigned url generated by Worker has upload size limit of 200/300/500 MB. Is that right? I thought presigned url doesn't have a size limit.
  • o

    oldmanmeta

    04/15/2023, 9:12 AM
    hi all - I had a function working yesterday to upload large files to a bucket. Come back today, and I'm getting CORS error. I've checked my CORS settings and my IP is included in the allowed, as well as the R2 API Token is a forever token. Any thoughts?
    s
    • 2
    • 11
  • o

    oldmanmeta

    04/15/2023, 9:14 AM
    Copy code
    from origin 'http://192.168.1.100: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.
  • o

    oldmanmeta

    04/15/2023, 9:15 AM
    I'm using the AWS S3 SDK V3 - but as I say, everything was working yesterday. {sigh}
  • s

    Sid | R2

    04/15/2023, 9:23 AM
    Can you link me to where you read that? That doesn't sound right. There are limits to how large files uploaded from the dashboard / Wrangler can be, but that has nothing to do with presigned URLs
  • c

    chientrm

    04/15/2023, 9:26 AM
    https://developers.cloudflare.com/r2/api/s3/presigned-urls/
  • c

    chientrm

    04/15/2023, 9:26 AM
    It states at the end of the guide 🤔
1...991992993...1050Latest