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

WC-2972: Allow Workers Assets to be mounted to a path #7476

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

Conversation

WalshyDev
Copy link
Member

@WalshyDev WalshyDev commented Dec 6, 2024

Fixes WC-2972.

Allow Workers Assets to be mounted to a wildcard path. We are still limiting unwildcarded paths like example.com/test for the minute though.

We will log a warning saying that we will attempt to serve assets along with the asset dir being matched. Also with a note saying unmatched will go to the Worker
image

Wording TBD here.


  • Tests
    • TODO (before merge)
    • Tests included
    • Tests not necessary because:
  • E2E Tests CI Job required? (Use "e2e" label or ask maintainer to run separately)
    • I don't know
    • Required
    • Not required because: not covered there
  • Public documentation

@WalshyDev WalshyDev requested a review from a team as a code owner December 6, 2024 12:49
Copy link

changeset-bot bot commented Dec 6, 2024

🦋 Changeset detected

Latest commit: 125a8a4

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 Dec 6, 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/12313790409/npm-package-wrangler-7476

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

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

Or you can use npx with this latest build directly:

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

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.

@Cherry
Copy link
Contributor

Cherry commented Dec 6, 2024

This is awesome to see, but "masking" is an odd way to describe this feature. "Masking" to me implies a sense of temporary-ness, or fake-ness, vs the industry standard of mounting that you see across lots of different software when you mount files/folders at a specific location, like inside containers.

Hopefully the naming is finalised, because "mount" makes way more senses than "mask" in my opinion.

@WalshyDev WalshyDev force-pushed the walshy/WC-2972 branch 3 times, most recently from 39dd224 to d2da9e6 Compare December 10, 2024 15:23
Copy link
Member

@GregBrimble GregBrimble left a comment

Choose a reason for hiding this comment

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

Sorry, not strictly related to your change, but before we release this, can we also make sure we have some asset-worker tests which assert that we do not leak out assets for requests like example.com/blog/../home and example.com/blog/%2E%2E/home? If we're saying in the docs that assets like /home.html are not directly accessible, we need to be confident in that.

.changeset/early-baboons-fly.md Outdated Show resolved Hide resolved
packages/workers-shared/asset-worker/tests/handler.test.ts Outdated Show resolved Hide resolved
packages/wrangler/src/__tests__/deploy.test.ts Outdated Show resolved Hide resolved
packages/wrangler/src/deploy/deploy.ts Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Review
Development

Successfully merging this pull request may close these issues.

5 participants