jaybee
jaybee
CDCloudflare Developers
Created by jaybee on 1/27/2025 in #r2
hey guys i’m really struggling with
i should make my bucket public for that right?
23 replies
CDCloudflare Developers
Created by jaybee on 1/27/2025 in #r2
hey guys i’m really struggling with
i don’t understand how my users would be able to use the pre signed url to see the posts they’ll have to generate a new url every time to see the posts?
23 replies
CDCloudflare Developers
Created by jaybee on 1/27/2025 in #r2
hey guys i’m really struggling with
s3 api
23 replies
CDCloudflare Developers
Created by jaybee on 1/27/2025 in #r2
hey guys i’m really struggling with
can you help me understand the flow of this using s3? i want my user to be able to upload images and see them as their posts on the feed
23 replies
CDCloudflare Developers
Created by jaybee on 1/27/2025 in #r2
hey guys i’m really struggling with
is there some guide for beginners that hand olds us throughout the process
23 replies
CDCloudflare Developers
Created by jaybee on 1/27/2025 in #r2
hey guys i’m really struggling with
i don’t seem to understand how to keep the bucket secure and at the same time let my users see the images on their feed
23 replies
CDCloudflare Developers
Created by jaybee on 1/27/2025 in #r2
hey guys i’m really struggling with
i’ve read the docs but they’re very jarring
23 replies
CDCloudflare Developers
Created by jaybee on 1/27/2025 in #r2
hey guys i’m really struggling with
@Space
23 replies
CDCloudflare Developers
Created by jaybee on 1/27/2025 in #r2
hey guys i’m really struggling with
how can i use custom domains? can you suggest some tutorial or doc?
23 replies
CDCloudflare Developers
Created by jaybee on 1/27/2025 in #r2
hey guys i’m really struggling with
i’m creating a project that allows users to share images so i’ve figured out the uploading part but for fetching those images from r2 bucket do i need to use a presigned url and how does it work like would i be able to render those images on my website
23 replies
CDCloudflare Developers
Created by jaybee on 1/27/2025 in #r2
hey guys i’m really struggling with
i’ve one question
23 replies
CDCloudflare Developers
Created by jaybee on 1/27/2025 in #r2
hey guys i’m really struggling with
i was looking for r2 tutorials all that time
23 replies
CDCloudflare Developers
Created by jaybee on 1/27/2025 in #r2
hey guys i’m really struggling with
@Space can you help with this?
23 replies
CDCloudflare Developers
Created by jaybee on 1/27/2025 in #r2
hey guys i’m really struggling with
i’m sending a get request with the file name in my r2 bucket but it’s giving me 405 forbidden method not allowed
23 replies
CDCloudflare Developers
Created by jaybee on 1/27/2025 in #r2
hey guys i’m really struggling with
i’m currently stuck on the get request to fetch image url
23 replies
CDCloudflare Developers
Created by jaybee on 1/27/2025 in #r2
hey guys i’m really struggling with
here is the upload handler route import { NextRequest, NextResponse } from "next/server"; import { PutObjectCommand, S3Client } from "@aws-sdk/client-s3"; const accessKeyId = process.env.R2_ACCESS_KEY ""; const secretAccessKey = process.env.R2_SECRET_KEY ""; const endpoint = process.env.CLOUDFLARE_ENDPOINT ""; const BUCKET = process.env.R2_BUCKET_NAME!; if (!accessKeyId !secretAccessKey || !endpoint) { throw new Error("Missing required Cloudflare R2 credentials or endpoint."); } const r2 = new S3Client({ region: "auto", endpoint: endpoint, credentials: { accessKeyId, secretAccessKey, }, }); export const POST = async (req: NextRequest) => { try { // Get the form data from the request const formData = await req.formData(); const file = formData.get("file") as File; // Get the file from the form // Convert the file to a buffer const bytes = await file.arrayBuffer(); const buffer = Buffer.from(bytes); // Create the PutObjectCommand to upload to R2 const putObjectCommand = new PutObjectCommand({ Bucket: BUCKET, // Your Cloudflare R2 bucket name Key: file.name, // File name in the R2 bucket Body: buffer, // File content }); // Send the command to upload the file to R2 const response = await r2.send(putObjectCommand); console.log("Upload Response:", response); // Return success response return NextResponse.json({ success: true }, { status: 200 }); } catch (error) { // Log and return error response console.error("Upload Error:", error); return NextResponse.json({ success: false, message: error.message }, { status: 500 }); } };
23 replies
CDCloudflare Developers
Created by jaybee on 1/27/2025 in #r2
hey guys i’m really struggling with
i’m using s3 to make these calls from my nextjs project
23 replies
CDCloudflare Developers
Created by jaybee on 1/27/2025 in #r2
hey guys i’m really struggling with
hi harshil, i’m currently in production and i’ve not yet deployed the app. i’m making an image sharing project, i need to upload and fetch images/posts from users
23 replies