Use hardcoded R2 credentials (for testing only)

This commit is contained in:
Manohar Gupta 2026-05-10 14:42:50 +05:30
parent 73c3ddb53e
commit 7b4f47667b

View file

@ -3,14 +3,15 @@ import { getSignedUrl } from "@aws-sdk/s3-request-presigner";
import { NextRequest, NextResponse } from "next/server";
function getR2() {
const accountId = process.env.R2_ACCOUNT_ID;
const accessKeyId = process.env.R2_ACCESS_KEY_ID;
const secretKey = process.env.R2_SECRET_ACCESS_KEY;
const bucket = process.env.R2_BUCKET_NAME;
// Debug: explicitly hardcode for now since env might not be passed to container
const accountId = "e71f22a2f8614fb3ba6d9b28a264d8ce";
const accessKeyId = "6606d525c8e647d94e051b6d6565803b";
const secretKey = "244fcc44041f452241cbc68374cd7a6ca651cb71f361bc36cc932407bbe37863";
const bucket = "tia";
if (!accountId || !accessKeyId || !secretKey || !bucket) {
throw new Error(`Missing R2 config: ${!!accountId} ${!!accessKeyId} ${!!secretKey} ${!!bucket}`);
}
if (!accountId || !accessKeyId || !secretKey || !bucket) {
throw new Error(`Missing R2 config`);
}
// S3 API endpoint includes bucket name: https://<accountId>.r2.cloudflarestorage.com/<bucket>
const endpoint = `https://${accountId}.r2.cloudflarestorage.com/${bucket}`;