Error when trying to get file from r2 via wrangler

home@portaltree ~ % npx wrangler r2 object get myobject/image.png
⛅️ wrangler 3.6.0
------------------
Downloading "image.png" from "myobject".

✘ [ERROR] Failed to fetch /accounts/ACCOUNT ID/r2/buckets/myobject/objects/image.png - 400: Bad Request);


If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose
home@portaltree ~ % npx wrangler r2 object get myobject/image.png
⛅️ wrangler 3.6.0
------------------
Downloading "image.png" from "myobject".

✘ [ERROR] Failed to fetch /accounts/ACCOUNT ID/r2/buckets/myobject/objects/image.png - 400: Bad Request);


If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose
1 Reply
potato
potato10mo ago
also when i try to access it via workers on local with miniflare it says the object wasnt found
const object = await env.BUCKET.get('image.png');
if (object === null) {
console.log("doesn't exist image");
} else {
console.log(typeof object);
}

const list = await env.BUCKET.list();
console.log(JSON.stringify(list))
const object = await env.BUCKET.get('image.png');
if (object === null) {
console.log("doesn't exist image");
} else {
console.log(typeof object);
}

const list = await env.BUCKET.list();
console.log(JSON.stringify(list))
[mf:inf] Updated and ready on http://127.0.0.1:50084/
doesn't exist image
{"objects":[],"truncated":false,"delimitedPrefixes":[]}
[mf:inf] GET /__scheduled 200 OK (12ms)
[mf:inf] Updated and ready on http://127.0.0.1:50084/
doesn't exist image
{"objects":[],"truncated":false,"delimitedPrefixes":[]}
[mf:inf] GET /__scheduled 200 OK (12ms)
I hate myself i accidentaly put a _ instead of a - in my bucket name in wrangler.toml 😭