How does the R2 R2ListOptions method work? Mine is getting empty even though there are objects in the bucket

I’m referring to this function to list the objects in the bucket from cloudflare workers:
Workers API reference · Cloudflare R2 docs https://developers.cloudflare.com/r2/api/workers/workers-api-reference/#r2listoptions

I have objects in the bucket(Double checked using the cloudflare dashboard UI), but the result returned is zero.

Does this function actually work, or there is something I’m missing?

I don’t know what happen. I deleted the deployed worker and after a while the same code started to work when I ran ‘wrangler dev --remote’. This time I didn’t run ‘wrangler deploy’ first.

Just leaving this here in case anyone else faced the same thing.

1 Like

Spent all day trying to pin down why all my buckets listed as empty, then saw your response.

Using wrangler dev --remote instead of wrangler dev totally worked; and now using wrangler dev without remote also works. This bug definitely needs to be squashed…