Skip to content

Conversation

@vicb
Copy link
Contributor

@vicb vicb commented Jul 7, 2025

Implement the recently introduced AssetResolver

Before this PR all assets had to be served before the app worker (run_worker_first=false which is the default value)

With this PR, when run_worker_first is set to true then the assets will be resolved during the routing phase, after the middleware. We will use that for skew protection as well.

(The code also supports when use_worker_first is set to an array of patterns)

@changeset-bot
Copy link

changeset-bot bot commented Jul 7, 2025

🦋 Changeset detected

Latest commit: 45003aa

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

This PR includes changesets to release 1 package
Name Type
@opennextjs/cloudflare Minor

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

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jul 7, 2025

Open in StackBlitz

npm i https://pkg.pr.new/@opennextjs/cloudflare@768

commit: 45003aa

Copy link
Collaborator

@james-elicx james-elicx left a comment

Choose a reason for hiding this comment

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

Looks like the e2es are failing. Logic looks good though.

@vicb
Copy link
Contributor Author

vicb commented Jul 8, 2025

Looks like the e2es are failing. Logic looks good though.

The value of run_worker_first was only pass to the server bundle and not to the middleware bundle.

I'll fix this by setting the value on globalThis in the init.

@vicb vicb changed the title Add support for serving assets from the routing feat: add support for serving assets from the routing layer Jul 8, 2025
@vicb vicb force-pushed the vicb/assetResolver branch from a3e0bbe to 2344ab8 Compare July 8, 2025 13:16
@vicb vicb force-pushed the vicb/assetResolver branch from 2344ab8 to 2517c28 Compare July 8, 2025 13:25
@vicb vicb requested a review from james-elicx July 8, 2025 14:55
@vicb
Copy link
Contributor Author

vicb commented Jul 8, 2025

Thanks for the review James!

@vicb vicb merged commit 40f7e72 into main Jul 8, 2025
7 checks passed
@vicb vicb deleted the vicb/assetResolver branch July 8, 2025 17:10
@vicb vicb mentioned this pull request Jul 9, 2025
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants