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 --remotesince it throws an error:
[ERROR] Cannot use assets in remote mode. Workers with assets are only supported in local mode. Please use `wrangler dev`.
[ERROR] Cannot use assets in remote mode. Workers with assets are only supported in local mode. Please use `wrangler dev`.
Whats should we do?
4 Replies
Jürgen Leschner
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.)
DangerZone
DangerZoneOP3mo ago
You are indeed correct, but we want to develop on the same tech as our production and staging workers.
Jürgen Leschner
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)
tanushree │ Workers PM
Thanks for the context! We are working on adding support for --remote in projects with assets this quarter.
Want results from more Discord servers?
Add your server