denchi
04/13/2023, 10:24 PMdenchi
04/13/2023, 10:24 PMdenchi
04/13/2023, 10:33 PMDBlessDev.eth
04/13/2023, 11:18 PMDBlessDev.eth
04/13/2023, 11:18 PMDBlessDev.eth
04/13/2023, 11:19 PMwrangler.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.DBlessDev.eth
04/13/2023, 11:21 PMDBlessDev.eth
04/13/2023, 11:21 PMDBlessDev.eth
04/13/2023, 11:21 PM[[r2_buckets]]
binding="CRYPTO_NOTIFICATIONS"
bucket_name="cryptocurrency-notifications"
preview_bucket_name="dv-cn"
Here's my wrangler.tomlDBlessDev.eth
04/13/2023, 11:22 PMimport 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?heartz
04/14/2023, 3:25 PMgotfredsen
04/14/2023, 3:39 PMgotfredsen
04/14/2023, 3:39 PMO Rato
04/14/2023, 3:42 PMgotfredsen
04/14/2023, 3:42 PMSid | R2
04/14/2023, 4:19 PMSid | R2
04/14/2023, 4:20 PMshakti150
04/15/2023, 6:42 AMSid | R2
04/15/2023, 6:49 AMshakti150
04/15/2023, 6:50 AMSid | R2
04/15/2023, 6:51 AMTubbyStubby2
04/15/2023, 6:55 AMKarew
04/15/2023, 7:24 AMchientrm
04/15/2023, 7:37 AMoldmanmeta
04/15/2023, 9:12 AMoldmanmeta
04/15/2023, 9:14 AMfrom 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.
oldmanmeta
04/15/2023, 9:15 AMSid | R2
04/15/2023, 9:23 AMchientrm
04/15/2023, 9:26 AMchientrm
04/15/2023, 9:26 AM