Can't access r2 object on worker
Cant acces it using worker but can using wrangler cli
const object = await env.BUCKET.get("channels4_profile.jpg");
const list = await env.BUCKET.list();
if (object === null) {
console.log("image doesn't exist");
} else {
console.log(typeof object);
}
console.log(JSON.stringify(object));
console.log(JSON.stringify(list, null, 2));const object = await env.BUCKET.get("channels4_profile.jpg");
const list = await env.BUCKET.list();
if (object === null) {
console.log("image doesn't exist");
} else {
console.log(typeof object);
}
console.log(JSON.stringify(object));
console.log(JSON.stringify(list, null, 2));[mf:inf] Ready on http://127.0.0.1:58463/
image doesn't exist
null
{
"objects": [],
"truncated": false,
"delimitedPrefixes": []
}
[mf:inf] GET /__scheduled 200 OK (74ms)[mf:inf] Ready on http://127.0.0.1:58463/
image doesn't exist
null
{
"objects": [],
"truncated": false,
"delimitedPrefixes": []
}
[mf:inf] GET /__scheduled 200 OK (74ms)home@portaltree ~ % npx wrangler r2 object get dev/channels4_profile.jpg
⛅️ wrangler 3.6.0
------------------
Downloading "channels4_profile.jpg" from "dev".
Download complete.home@portaltree ~ % npx wrangler r2 object get dev/channels4_profile.jpg
⛅️ wrangler 3.6.0
------------------
Downloading "channels4_profile.jpg" from "dev".
Download complete.