but its running on ec2 instace now i

but its running on ec2 instace now i wanna make upload fn to be run on serverless and i have no idea whats wrangler
11 Replies
Nitish
NitishOP10mo ago
ok i will do it again and if i face somethinng i will ping you thankyou 🙂
Nitish
NitishOP10mo ago
i want make upload api so 4 th option is good for me?
No description
Nitish
NitishOP10mo ago
# Bind an R2 Bucket. Use R2 to store arbitrarily large blobs of data, such as files.
# Docs: https://developers.cloudflare.com/r2/api/workers/workers-api-usage/
# [[r2_buckets]]
# binding = "MY_BUCKET"
# bucket_name = "my-bucket"
# Bind an R2 Bucket. Use R2 to store arbitrarily large blobs of data, such as files.
# Docs: https://developers.cloudflare.com/r2/api/workers/workers-api-usage/
# [[r2_buckets]]
# binding = "MY_BUCKET"
# bucket_name = "my-bucket"
i will have to replce this with actual keys?
Nitish
NitishOP10mo ago
i dont find account_id i assume its id in wrangler.toml?
No description
Nitish
NitishOP10mo ago
and binding is prefix? okay! my bucket name is test
npx wrangler r2 bucket list
[
{
"name": "test",
"creation_date": "2024-01-21T18:14:12.685Z"
}
]
npx wrangler r2 bucket list
[
{
"name": "test",
"creation_date": "2024-01-21T18:14:12.685Z"
}
]
that i have account_id and accessKey secret values alright got error 1101 const object = await env.MY_BUCKET.get(key); getting errot on this line, i have configured my_bucket in toml file still 😐 Cannot read properties of undefined (reading 'get')
switch (request.method) {
case 'PUT':
await env.MY_BUCKET.put(key, request.body);
return new Response(`Put ${key} successfully!`);
case 'GET':
const object = await env.MY_BUCKET.get(key);

if (object === null) {
return new Response('Object Not Found', { status: 404 });
}

switch (request.method) {
case 'PUT':
await env.MY_BUCKET.put(key, request.body);
return new Response(`Put ${key} successfully!`);
case 'GET':
const object = await env.MY_BUCKET.get(key);

if (object === null) {
return new Response('Object Not Found', { status: 404 });
}

this line
const object = await env.MY_BUCKET.get(key);
const object = await env.MY_BUCKET.get(key);
Nitish
NitishOP10mo ago
Indentation problem?
No description
Nitish
NitishOP10mo ago
okay! finally progress maybe now i can move further how silly im :/ i need help how can i upload images and get it issue is that here i can send params and getting params response
Nitish
NitishOP10mo ago
someone its uploaded to this but i cant access bucket is public i can accesss other data but not this
No description
Nitish
NitishOP10mo ago
@nora you there? i have added dns record to bucket and all other files are accessible using that domain except that i did with worker i dont understand vc? possible for you? please check dm i sent you link! its not image its r2 bucket link
Nitish
NitishOP10mo ago
i upload others image from s3 sdk and test.jpg is from worker what i am working on
No description
Nitish
NitishOP10mo ago
i can access all other picture from public link but test.jpg is not accessible do i have to upload base64? okay! thanks 😄
Want results from more Discord servers?
Add your server