fix(core): fix Vercel skew protection bug for island hydration URLs#15931
Open
Strernd wants to merge 3 commits intowithastro:mainfrom
Open
fix(core): fix Vercel skew protection bug for island hydration URLs#15931Strernd wants to merge 3 commits intowithastro:mainfrom
Strernd wants to merge 3 commits intowithastro:mainfrom
Conversation
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This fixes a Vercel skew protection bug:
astro-islandhydration URLs were missing adapterassetQueryParams(for example?dpl=), so island JS was not pinned to the active deployment.Reproduction
I validated this against the reproduction project (
repro-skew-protection) and Astro core changes from this branch:Before this fix, rendered islands had:
component-url="/_astro/...js"(nodpl)renderer-url="/_astro/...js"(nodpl)With this fix, rendered islands have:
component-url="/_astro/...js?dpl=dpl_test123"renderer-url="/_astro/...js?dpl=dpl_test123"Changes
packages/astro/src/core/build/plugins/plugin-manifest.tsentryModuleswithappendAssetQuery(...)so island URL resolution getsassetQueryParams.packages/astro/src/core/render/ssr-element.tscreateAssetLink()query/hash-aware:?vs&, before hash)assetsPrefixrouting when URLs already contain query params.packages/astro/test/asset-query-params.test.jscomponent-urlandrenderer-urlinclude?dpl=test-deploy-id.assetsPrefixmap (js/css/fallback) +assetQueryParams, ensuring island URLs still use JS CDN prefix.Testing
All pass.
Context
Related: #14545, #14543, #14627, #14853