Skip to content
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

Add basic support for wrappedBindings and RPC entrypoints to Miniflare's Magic Proxy #5599

Merged
merged 7 commits into from
Apr 15, 2024

Conversation

penalosa
Copy link
Contributor

@penalosa penalosa commented Apr 12, 2024

What this PR solves / how to test

This fixes a number of issues with the Miniflare magic proxy, including:

Author has addressed the following

Copy link

changeset-bot bot commented Apr 12, 2024

🦋 Changeset detected

Latest commit: 8fdc2b0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
miniflare Patch
@cloudflare/pages-shared Patch
@cloudflare/vitest-pool-workers Patch
wrangler Patch

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

@penalosa penalosa added the e2e Run e2e tests on a PR label Apr 12, 2024
Copy link
Contributor

github-actions bot commented Apr 12, 2024

A wrangler prerelease is available for testing. You can install this latest build in your project with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8692725908/npm-package-wrangler-5599

You can reference the automatically updated head of this PR with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/5599/npm-package-wrangler-5599

Or you can use npx with this latest build directly:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8692725908/npm-package-wrangler-5599 dev path/to/script.js
Additional artifacts:
npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8692725908/npm-package-create-cloudflare-5599 --no-auto-update
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8692725908/npm-package-cloudflare-kv-asset-handler-5599
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8692725908/npm-package-miniflare-5599
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8692725908/npm-package-cloudflare-pages-shared-5599
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8692725908/npm-package-cloudflare-vitest-pool-workers-5599

Note that these links will no longer work once the GitHub Actions artifact expires.


wrangler@3.50.0 includes the following runtime dependencies:

Package Constraint Resolved
miniflare workspace:* 3.20240405.1
workerd 1.20240405.0 1.20240405.0
workerd --version 1.20240405.0 2024-04-05

Please ensure constraints are pinned, and miniflare/workerd minor versions match.

@dario-piotrowicz
Copy link
Member

dario-piotrowicz commented Apr 13, 2024

With the correct env variables the wrangler AI e2e passes locally:
Screenshot 2024-04-13 at 16 57 54

on Github I think we need to make sure that the CLOUDFLARE_API_TOKEN grants access to Workers AI (I've tested with this with my own Cloudflare account id and api token) (to fix this error. Regarding the python e2e failures I am not sure what they are about, I don't think they are related to this PR as I can see those failing elsewhere too)

I don't think I have permissions to do the above, maybe someone could help me? 🙂 @petebacondarwin? 🙏

---------

Co-authored-by: Samuel Macleod <smacleod@cloudflare.com>
…oxy()`

---------

Co-authored-by: Samuel Macleod <smacleod@cloudflare.com>
@dario-piotrowicz dario-piotrowicz force-pushed the penalosa/miniflare-api-wrapped-bindings branch from 5b767f0 to c071182 Compare April 13, 2024 22:14
@dario-piotrowicz
Copy link
Member

dario-piotrowicz commented Apr 13, 2024

Note

The wrappedBindings support is not perfect, it seems to break in some cases: https://github.com/dario-piotrowicz/miniflare-wrappedBindings-getBindings-function-stringification-error-repro
but it is good enough for the AI binding, so if it'd be acceptable I'd like to proceed with the current solution
(to enable AI binding proxies as soon as we can) and address the above issue as a follow up

I think I've already got a solution for this: 01fa456 but I'd prefer not to scope creep this PR and try to lend it asap instead of piling stuff on top of it

@dario-piotrowicz dario-piotrowicz force-pushed the penalosa/miniflare-api-wrapped-bindings branch from c071182 to 375aed1 Compare April 13, 2024 22:46
---------

Co-authored-by: Samuel Macleod <smacleod@cloudflare.com>
@dario-piotrowicz dario-piotrowicz force-pushed the penalosa/miniflare-api-wrapped-bindings branch from 375aed1 to 895c520 Compare April 13, 2024 23:16
@dario-piotrowicz dario-piotrowicz marked this pull request as ready for review April 13, 2024 23:28
@dario-piotrowicz dario-piotrowicz requested a review from a team as a code owner April 13, 2024 23:28
@dario-piotrowicz dario-piotrowicz changed the title Improve Miniflare Magic Proxy Add basic support for wrappedBindings and RPC entrypoints to Miniflare's Magic Proxy Apr 13, 2024
@dario-piotrowicz dario-piotrowicz merged commit c9f081a into main Apr 15, 2024
15 of 18 checks passed
@dario-piotrowicz dario-piotrowicz deleted the penalosa/miniflare-api-wrapped-bindings branch April 15, 2024 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
e2e Run e2e tests on a PR
Projects
Archived in project
4 participants