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

feat(wrangler): Add remote mode support for Workers + Assets #7380

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

CarmenPopoviciu
Copy link
Contributor

@CarmenPopoviciu CarmenPopoviciu commented Nov 28, 2024

Fixes DEVX-1522
⛔️ Depends on EWC changes that are not in place yet

This PR adds remote mode support in wrangler dev for Workers + Assets.

The current implementation will always upload assets to the edge, before deploying the User Worker to Edge Preview (which is what wrangler dev --remote already does). This means that for Workers + Assets, the User Worker, Router Worker, Asset Workers, the assets and any other resources all run at the edge (see diagram below).

Screenshot 2024-11-29 at 11 19 19

@CarmenPopoviciu CarmenPopoviciu requested a review from a team as a code owner November 28, 2024 13:01
Copy link

changeset-bot bot commented Nov 28, 2024

🦋 Changeset detected

Latest commit: b2c0f6d

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

This PR includes changesets to release 2 packages
Name Type
wrangler Minor
@cloudflare/vitest-pool-workers 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 Nov 28, 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/12281681557/npm-package-wrangler-7380

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

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

Or you can use npx with this latest build directly:

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

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


[email protected] includes the following runtime dependencies:

Package Constraint Resolved
miniflare workspace:* 3.20241205.0
workerd 1.20241205.0 1.20241205.0
workerd --version 1.20241205.0 2024-12-05

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

@CarmenPopoviciu CarmenPopoviciu force-pushed the carmen/assets-remote-mode branch 3 times, most recently from 065afe9 to aba3f32 Compare November 28, 2024 13:17
@CarmenPopoviciu CarmenPopoviciu changed the title feat(wrangler): Add remote mode support for Workers + Assets [DO NOT MERGE] feat(wrangler): Add remote mode support for Workers + Assets Nov 28, 2024
try {
const { workerAccount, workerContext } = await getWorkerAccountAndContext(
Copy link
Contributor Author

@CarmenPopoviciu CarmenPopoviciu Nov 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moving this code higher in the call chain so we can extract the Worker scriptId and pass it into createRemoteWorkerInit. createRemoteWorkerInit needs the Worker name to be defined so that it can make the assets upload API call, which would otherwise have unintended side effects

The logic of this code block has not changed!

@CarmenPopoviciu CarmenPopoviciu force-pushed the carmen/assets-remote-mode branch from aba3f32 to eddd402 Compare November 28, 2024 14:28
@CarmenPopoviciu CarmenPopoviciu added the e2e Run e2e tests on a PR label Nov 28, 2024
@CarmenPopoviciu CarmenPopoviciu force-pushed the carmen/assets-remote-mode branch from eddd402 to 619b25e Compare November 28, 2024 15:39
@petebacondarwin petebacondarwin marked this pull request as draft December 2, 2024 14:21
@CarmenPopoviciu CarmenPopoviciu force-pushed the carmen/assets-remote-mode branch from 619b25e to 5b20edd Compare December 3, 2024 15:06
@CarmenPopoviciu CarmenPopoviciu changed the title [DO NOT MERGE] feat(wrangler): Add remote mode support for Workers + Assets feat(wrangler): Add remote mode support for Workers + Assets Dec 3, 2024
@CarmenPopoviciu CarmenPopoviciu added the blocked Blocked on other work label Dec 5, 2024
@CarmenPopoviciu CarmenPopoviciu force-pushed the carmen/assets-remote-mode branch from 5b20edd to b2c0f6d Compare December 11, 2024 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Blocked on other work e2e Run e2e tests on a PR
Projects
Status: Untriaged
Development

Successfully merging this pull request may close these issues.

1 participant