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

fix: allow getPlatformProxy to handle RPC calls returning objects #6301

Merged
merged 3 commits into from
Jul 30, 2024

Conversation

dario-piotrowicz
Copy link
Member

@dario-piotrowicz dario-piotrowicz commented Jul 20, 2024

What this PR solves / how to test

Fixes #6285

Fixes the first point of #6235

Author has addressed the following

  • Tests
    • TODO (before merge)
    • Included
    • Not necessary because:
  • E2E Tests CI Job required? (Use "e2e" label or ask maintainer to run separately)
    • I don't know
    • Required / Maybe required
    • Not required because:
  • Changeset (Changeset guidelines)
    • TODO (before merge)
    • Included
    • Not necessary because:
  • Public documentation
    • TODO (before merge)
    • Cloudflare docs PR(s):
    • Not necessary because: bugfix

As part of #5922 I've removed the code that we had (implemented by @penalosa) that dropped the problematic dispose and asyncDispose properties from RpcPropertys (see here), as I thought that such operations were no longer necessary (and there were no tests showing that removing them was breaking something) but it turns out that they are 😓, so I am reinstating the old code back and adding tests to make sure we don't re-regress on this 🙂

@dario-piotrowicz dario-piotrowicz requested a review from a team as a code owner July 20, 2024 15:30
Copy link

changeset-bot bot commented Jul 20, 2024

🦋 Changeset detected

Latest commit: 5a4fb43

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

Copy link
Contributor

github-actions bot commented Jul 20, 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/10161265027/npm-package-wrangler-6301

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

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

Or you can use npx with this latest build directly:

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

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


wrangler@3.67.1 includes the following runtime dependencies:

Package Constraint Resolved
miniflare workspace:* 3.20240718.1
workerd 1.20240718.0 1.20240718.0
workerd --version 1.20240718.0 2024-07-18

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

@Klowner
Copy link

Klowner commented Jul 20, 2024

I've been baffled by the same issue for a couple weeks now and the prerelease above fixes it for me 👍
Thank you!

@CarmenPopoviciu
Copy link
Contributor

after talking to Dario async, seems like this PR introduces a small regression (see #6235 (comment)). Let's hold off merging it until I discuss this with our team

@dario-piotrowicz dario-piotrowicz marked this pull request as draft July 23, 2024 16:39
@workers-devprod workers-devprod added the e2e Run e2e tests on a PR label Jul 28, 2024
@dario-piotrowicz dario-piotrowicz force-pushed the getPlatformProxy-RPC-obj branch 2 times, most recently from 2054447 to c65d040 Compare July 28, 2024 13:02
allow the `getPlatformProxy` to handle RPC calls returning objects by making
sure that the miniflare magic proxy can take into account methods set via
symbols (in the case or RPC objects specifically `Symbol.dispose` and `Symbol.asyncDispose`)

additionally add more RPC test coverage in miniflare
@dario-piotrowicz dario-piotrowicz force-pushed the getPlatformProxy-RPC-obj branch from c65d040 to d044599 Compare July 28, 2024 13:14
@dario-piotrowicz dario-piotrowicz marked this pull request as ready for review July 28, 2024 13:20
@dario-piotrowicz
Copy link
Member Author

@CarmenPopoviciu I've refactored the PR and now it's not introducing any regression at all 😄

If should be pretty good to go! 😃

Please give it another quick review if you would 🙏

@dario-piotrowicz dario-piotrowicz merged commit 44ad2c7 into main Jul 30, 2024
20 checks passed
@dario-piotrowicz dario-piotrowicz deleted the getPlatformProxy-RPC-obj branch July 30, 2024 11:53
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
Development

Successfully merging this pull request may close these issues.

🐛 BUG: Error Cannot stringify POJOs with symbolic keys when calling RPC method through getPlatformProxy
6 participants