workers-rs icon indicating copy to clipboard operation
workers-rs copied to clipboard

Add Service Binding Support

Open ImSingee opened this issue 2 years ago • 3 comments

The PR adds support for Service Bindings

ImSingee avatar May 14 '22 13:05 ImSingee

@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.

ImSingee avatar May 18 '22 00:05 ImSingee

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?

ImSingee avatar May 18 '22 00:05 ImSingee

miniflare 2.6.0 allegedly has bindings support: https://github.com/cloudflare/miniflare/issues/301

cjpatton avatar Jul 27 '22 15:07 cjpatton

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?

sergey-melnychuk avatar Oct 14 '22 18:10 sergey-melnychuk

Closing in favor of #243

zebp avatar Nov 17 '22 15:11 zebp