Accessing Remote R2 while having local assets
Hey,
I am trying to build a worker that can access my remote R2 buckets, but still have local static assets to serve.
From my research it looks like its common to have an R2 assets bucket to solve this issue, but because multiple develpers are going to work on this worker, we don't want them to share the same assets bucket.
Our current limitations:
- We can't seed the local R2 since our data set is too big, and we need to know which data is seeded specifically across tens of buckets.
- We can't have a remote assets folder since we don't want engineers to share them.
- We can't have local assets with
wrangler dev --remote
since it throws an error:
Whats should we do?4 Replies
I didn't know that assets don't work work with --remote - (confirmed tx). That seems like something that should be supported in future.
One idea for a workaround might be to use the R2 s3 api (with a token) instead of the
[[r2_buckets]]
worker binding when running locally. (Not ideal, I agree.)You are indeed correct, but we want to develop on the same tech as our production and staging workers.
Another workaround would be to use the old worker sites feature - it uploads the assets when you run
wrangler dev --remote
.
(worse than the s3 api suggestion imo)
cc @tanushree │ Workers PM (this is the R2 --remote use case I mentioned)Thanks for the context! We are working on adding support for
--remote
in projects with assets this quarter.