-
Notifications
You must be signed in to change notification settings - Fork 716
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add service bindings support #683
feat: add service bindings support #683
Conversation
🦋 Changeset detectedLatest commit: fabaf8b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
A wrangler prerelease is available for testing. You can install this latest build in your project with: npm install --save-dev https://prerelease-registry.developers.workers.dev/runs/2031004280/npm-package-wrangler-683 You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.developers.workers.dev/prs/683/npm-package-wrangler-683 Or you can use npx https://prerelease-registry.developers.workers.dev/runs/2031004280/npm-package-wrangler-683 dev path/to/script.js |
2f28213
to
59b803e
Compare
59b803e
to
fabaf8b
Compare
Let's use "name" instead of binding. Also, does this work with wrangler dev? |
"wrangler": patch | ||
--- | ||
|
||
feat: add service bindings support |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add a description of what service bindings are, and a short example of what a service configuration in wrangler.toml would look like.
I worry about the use of
I appreciate that it would be better if all these bindings were more uniform, but I am not sure that using |
I'd double down and say that "service" should be called "script_name" |
I'd argue As for |
I don't feel super strongly about this since it's not consistent anyway across the different types, and don't want to block the PR. I'm more curious whether this works with |
Hey @threepointone , This doesn't work with Binding name ambiguityAs for the name of the bindings, I agree that using The first one used by The second one used by We could make the service bindings be one or the other, what do you all think? |
Reading the comment in the code |
I'm not comfortable landing this PR until it works for wrangler dev, it feels incomplete until then. Folks can still use unsafe.bindings if they want it before that. |
Any updates here @danielrs? |
Closing this in favour of #906 |
When running in Jest, `require("undici")` inside a worker thread fails. Instead, we need to call `createRequire()` first, using the `__filename` of the worker host. The `require` function returned from that can then be used to `require("undici")`.
When running in Jest, `require("undici")` inside a worker thread fails. Instead, we need to call `createRequire()` first, using the `__filename` of the worker host. The `require` function returned from that can then be used to `require("undici")`.
When running in Jest, `require("undici")` inside a worker thread fails. Instead, we need to call `createRequire()` first, using the `__filename` of the worker host. The `require` function returned from that can then be used to `require("undici")`.
When running in Jest, `require("undici")` inside a worker thread fails. Instead, we need to call `createRequire()` first, using the `__filename` of the worker host. The `require` function returned from that can then be used to `require("undici")`.
Soon service bindings won't be experimental, this PR adds service bindings support to Wrangler 2.
Adds warning to unsafe bindings that were used as "raw" service bindings
Background
Experimental service bindings
Link: #166
Initial take on service bindings, replaced by the more generic unsafe bindings below.
Unsafe bindings
Link: #411
Used for any binding type not officially supported by Wrangler, including service bindings until today.