workers-rs
workers-rs copied to clipboard
Add Service Binding Support
The PR adds support for Service Bindings
@zebp For the name, I think now (in the dashboard) the previous Worker Script
is now totally renamed to Service
, So I think a Service Binding
implies the Remote Service Binding
, which is difference from the current local service.
I don't think my name is right, but I don't think just name itservice
is good either.
For test, I think we must use wrangler2, and it seems that the wrangler.toml
should be changed too, maybe like this (remove type
and change build.upload
to main
):
name = "testing-rust-worker"
workers_dev = true
compatibility_date = "2021-11-27" # required
main = "build/worker/shim.js"
kv_namespaces = [
{ binding = "SOME_NAMESPACE", id = "", preview_id = "" },
{ binding = "FILE_SIZES", id = "", preview_id = "" },
]
vars = { SOME_VARIABLE = "some value" }
[durable_objects]
bindings = [{ name = "COUNTER", class_name = "Counter" }]
[build]
command = "worker-build --release"
And after the migration to wrangler2 has been done, I think I can add a test easily.
BTW, the current support for service binding in wrangler2 is merged (in https://github.com/cloudflare/wrangler2/pull/906) but isn't released now, so maybe we need to wait for their release?
miniflare 2.6.0 allegedly has bindings support: https://github.com/cloudflare/miniflare/issues/301
Friendly ping @zebp @ImSingee Any chance of making any progress here anytime soon? :) If not, any objections if I pick it put and push to an acceptable form?
Closing in favor of #243