How to get R2 to work with Astro?
I want to use CF R2 in Astro + CF Pages project, I have setup the domain and made the bucket public. But when i try to make a put into R2, it doesn't do anything.
Am i doing anything wrong? is there a way to debug this?
I'm using Astro's actions here
When i console log the env, I'm getting all cf related env's logged.
the code runs and prints all the logs. I don't see any errors coming. Is there a way to debug R2?
It worked at some point and then it didnt work. I guess it has something to do with env
11 Replies
this is how my wrangler.toml looks like
How are you testing? If it local then you won't see the results in the R2 dashboard
i'm testing locally and also by running a local build and then previewing it using
wrangler pages dev
command.What do you see under your
.wrangler/state
in the project? That is where resources will go with local modeits empty
i initially got it upload images to r2. it worked, but then i'm wondering what changes to break it.
i deleted the r2 bucket, and created again using wrangler cli. still same.
when i try to access an image, i get 404
this is the setup
Have you deployed a version of your project? That is the only way you will see items show in the dashboard
no, let me deploy and test.
i can do
R2.get
, R2.list
etc in local and get results. so i asssumed R2.put
can also be performed in local.Yeah it should be able to