Can I assign a worker binding during runtime?
Provided I have the
account_id
and the bucketName
as well as an api key with the ability to do this, can I dynamically assign a binding to a worker on runtime?7 Replies
The goal is to not use the API
and use something like:
const bucket = env[data.params.bucket]
having that be the same as a normal regular binding set in wrangler.toml
Dynamic bindings is something that isn't possible today, but is being worked on
Thanks!
Do you know if that is something that is coming in the near future (a few months) or later?
If later I might have to use the api key and manually do every request the API way
.-.
Just wondering so I can better organize myself!There isn't an ETA available that I could share, it's just being worked on and will release when it's ready. Sorry for the trouble there.
For R2 I would suggest using the S3-compatible API within the Worker using e.g. aws4fetch or the AWS SDK
I appreciate your candor. Thank you nonetheless!
Also, is there a particular way I can get notified when it is ready?
(Besides following the discord)
It should be posted on https://developers.cloudflare.com/changelog or https://blog.cloudflare.com/ and you can subscribe to updates for specific products with the
/subscribe
command here (I imagine this may fall under the Workers one)
I don't believe there's a way to be notified for that feature specificallyPS: My ultimate goal here is to be able to access r2 buckets from different accounts within the same worker.
As a suggestion, if this were to be possible through the
wrangler.toml
file, that would be heaven for me!
Thanks!
(As some further context) I would like to be able to manage a few of my client's r2 buckets from within the same place.
Hope this helps
May you have a wonderful day and thanks again for your assistance!
=]
i'd imagine extending this:
into something like: