-
Notifications
You must be signed in to change notification settings - Fork 1k
Various fixes/improvements around remote bindings being used as local #11162
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
Merged
Merged
Changes from 8 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
a3ed9a7
Fix bindings with `remote: true` being logged as `remote` when run vi…
dario-piotrowicz efc3494
remote outdated tsdoc param
dario-piotrowicz 70383ae
Update the description of the `--local` flag for the `wrangler dev` c…
dario-piotrowicz 2230f82
fixup! Update the description of the `--local` flag for the `wrangler…
dario-piotrowicz 4ebead9
add changeset and disable remote bindings when `localBindingsOnly` is…
dario-piotrowicz 443b6cb
make sure startWorker doesn't connect to remote bindings when localBi…
dario-piotrowicz 07efcac
add hack not to break `wrangler pages dev`
dario-piotrowicz ba50b6a
add `localBindingsOnly` option to `getPlatformProxy` to disable the r…
dario-piotrowicz 0fc182b
use `remoteBindings` instead of `localBindingsOnly`
dario-piotrowicz ef2101d
Apply suggestions from code review
dario-piotrowicz 1476462
remove unnecessary timeout
dario-piotrowicz 0c14ec8
fix incorrect check in `getPlatformProxy`
dario-piotrowicz bfed066
remove unnecessary function wrapping
dario-piotrowicz b9b0e54
remove unnecessary function invocation
dario-piotrowicz 7b9a624
remove `startDev` change
dario-piotrowicz 0777e3b
remove unnecessary new `remoteBindings` option from `startWorker`
dario-piotrowicz a061a10
add `remoteBindings` option to vite plugin
dario-piotrowicz fa36841
skip e2e vite test on windows
dario-piotrowicz cf7cc62
Update packages/wrangler/src/api/integrations/platform/index.ts
dario-piotrowicz d335b5b
revert unnecessary spreading
dario-piotrowicz 3db45f9
rename `remoteBindingsEnabled` to `remoteBindings`
dario-piotrowicz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "wrangler": minor | ||
| --- | ||
|
|
||
| add a `localBindingsOnly` option to `getPlatformProxy` to disable the remote aspect of remote bindings |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "wrangler": patch | ||
| --- | ||
|
|
||
| Update the description of the `--local` flag for the `wrangler dev` command to clarify that it disables remote bindings, also un-deprecate and un-hide it |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "wrangler": minor | ||
| --- | ||
|
|
||
| Add `localBindingsOnly` option to `startWorker` to disable remote bindings |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "wrangler": patch | ||
| --- | ||
|
|
||
| Fix bindings with `remote: true` being logged as `remote` when run via `wrangler dev --local` |
30 changes: 30 additions & 0 deletions
30
fixtures/get-platform-proxy-remote-bindings/tests/local-bindings-only.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import { describe, expect, test } from "vitest"; | ||
| import { getPlatformProxy } from "wrangler"; | ||
| import type { Ai } from "@cloudflare/workers-types/experimental"; | ||
|
|
||
| describe( | ||
| "getPlatformProxy - remote bindings with localBindingsOnly", | ||
| { timeout: 50_000 }, | ||
| () => { | ||
| test("getPlatformProxy works with remote bindings", async () => { | ||
| const { env, dispose } = await getPlatformProxy<{ | ||
| AI: Ai; | ||
| }>({ | ||
| configPath: "./wrangler.local-bindings-only.jsonc", | ||
| localBindingsOnly: true, | ||
| }); | ||
|
|
||
| await expect( | ||
| (async () => { | ||
| await env.AI.run("@cf/meta/llama-3.1-8b-instruct-fp8", { | ||
| messages: [], | ||
| }); | ||
| })() | ||
| ).rejects.toThrowErrorMatchingInlineSnapshot( | ||
| `[Error: Binding AI needs to be run remotely]` | ||
| ); | ||
|
|
||
| await dispose(); | ||
| }); | ||
| } | ||
| ); |
8 changes: 8 additions & 0 deletions
8
fixtures/get-platform-proxy-remote-bindings/wrangler.local-bindings-only.jsonc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "name": "get-platform-proxy-remote-bindings-with-local-bindings-only-test", | ||
| "compatibility_date": "2025-05-07", | ||
| "ai": { | ||
| "binding": "AI", | ||
| "remote": true, | ||
| }, | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.