Skip to content

fix(core): fix Vercel skew protection bug for island hydration URLs#15931

Merged
matthewp merged 4 commits intowithastro:mainfrom
Strernd:fix-skew-protection-island-hydration-urls
Mar 17, 2026
Merged

fix(core): fix Vercel skew protection bug for island hydration URLs#15931
matthewp merged 4 commits intowithastro:mainfrom
Strernd:fix-skew-protection-island-hydration-urls

Conversation

@Strernd
Copy link
Copy Markdown
Contributor

@Strernd Strernd commented Mar 16, 2026

Summary

This fixes a Vercel skew protection bug: astro-island hydration URLs were missing adapter assetQueryParams (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:

VERCEL_DEPLOYMENT_ID=dpl_test123 VERCEL_SKEW_PROTECTION_ENABLED=1 npx astro build

Before this fix, rendered islands had:

  • component-url="/_astro/...js" (no dpl)
  • renderer-url="/_astro/...js" (no dpl)

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.ts

    • Serialize entryModules with appendAssetQuery(...) so island URL resolution gets assetQueryParams.
    • Keep raw entry module values for static file tracking and page script handling to avoid double-appending.
  • packages/astro/src/core/render/ssr-element.ts

    • Make createAssetLink() query/hash-aware:
      • extension detection now uses pathname without query/hash
      • query params are appended safely (? vs &, before hash)
    • This preserves extension-based assetsPrefix routing when URLs already contain query params.
  • packages/astro/test/asset-query-params.test.js

    • Add island coverage asserting component-url and renderer-url include ?dpl=test-deploy-id.
    • Add regression coverage for assetsPrefix map (js/css/fallback) + assetQueryParams, ensuring island URLs still use JS CDN prefix.

Testing

pnpm -C packages/astro run build:ci
pnpm -C packages/astro exec astro-scripts test "test/asset-query-params.test.js"
pnpm -C packages/astro exec astro-scripts test "test/astro-assets-prefix-multi-cdn.test.js"

All pass.

Context

Related: #14545, #14543, #14627, #14853

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 16, 2026

🦋 Changeset detected

Latest commit: 3fb9be3

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

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

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Mar 16, 2026
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Mar 16, 2026

Merging this PR will not alter performance

✅ 18 untouched benchmarks


Comparing Strernd:fix-skew-protection-island-hydration-urls (3fb9be3) with main (f5cc2b0)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (4c54123) during the generation of this report, so f5cc2b0 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@Strernd Strernd marked this pull request as ready for review March 16, 2026 13:30
@matthewp
Copy link
Copy Markdown
Contributor

@Strernd looks great, can you add a changeset? pnpm run changeset ?

@Strernd Strernd force-pushed the fix-skew-protection-island-hydration-urls branch from 01ac7a7 to 22461e2 Compare March 17, 2026 07:54
@Strernd
Copy link
Copy Markdown
Contributor Author

Strernd commented Mar 17, 2026

@matthewp done!

@matthewp matthewp merged commit 98dfb61 into withastro:main Mar 17, 2026
26 checks passed
@astrobot-houston astrobot-houston mentioned this pull request Mar 17, 2026
dadezzz pushed a commit to dadezzz/ice-notes that referenced this pull request Mar 22, 2026
This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [astro](https://astro.build) ([source](https://github.com/withastro/astro/tree/HEAD/packages/astro)) | [`6.0.5` → `6.0.6`](https://renovatebot.com/diffs/npm/astro/6.0.5/6.0.6) | ![age](https://developer.mend.io/api/mc/badges/age/npm/astro/6.0.6?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/astro/6.0.5/6.0.6?slim=true) |

---

### Release Notes

<details>
<summary>withastro/astro (astro)</summary>

### [`v6.0.6`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#606)

[Compare Source](https://github.com/withastro/astro/compare/astro@6.0.5...astro@6.0.6)

##### Patch Changes

- [#&#8203;15965](withastro/astro#15965) [`2dca307`](withastro/astro@2dca307) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes client hydration for components imported through Node.js subpath imports (`package.json#imports`, e.g. `#components/*`), for example when using the Cloudflare adapter in development.

- [#&#8203;15770](withastro/astro#15770) [`6102ca2`](withastro/astro@6102ca2) Thanks [@&#8203;jpc-ae](https://github.com/jpc-ae)! - Updates the `create astro` welcome message to highlight the graceful dev/preview server quit command rather than the kill process shortcut

- [#&#8203;15953](withastro/astro#15953) [`7eddf22`](withastro/astro@7eddf22) Thanks [@&#8203;Desel72](https://github.com/Desel72)! - fix(hmr): eagerly recompile on style-only change to prevent stale slots render

- [#&#8203;15916](withastro/astro#15916) [`5201ed4`](withastro/astro@5201ed4) Thanks [@&#8203;trueberryless](https://github.com/trueberryless)! - Fixes `InferLoaderSchema` type inference for content collections defined with a loader that includes a `schema`

- [#&#8203;15864](withastro/astro#15864) [`d3c7de9`](withastro/astro@d3c7de9) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Removes temporary support for Node >=20.19.1 because Stackblitz now uses Node 22 by default

- [#&#8203;15944](withastro/astro#15944) [`a5e1acd`](withastro/astro@a5e1acd) Thanks [@&#8203;fkatsuhiro](https://github.com/fkatsuhiro)! - Fixes SSR dynamic routes with `.html` extension (e.g. `[slug].html.astro`) not working

- [#&#8203;15937](withastro/astro#15937) [`d236245`](withastro/astro@d236245) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixes an issue where HMR didn't correctly work on Windows when adding/changing/deleting routes in `pages/`.

- [#&#8203;15931](withastro/astro#15931) [`98dfb61`](withastro/astro@98dfb61) Thanks [@&#8203;Strernd](https://github.com/Strernd)! - Fix skew protection query params not being applied to island hydration `component-url` and `renderer-url`, and ensure query params are appended safely for asset URLs with existing search/hash parts.

- Updated dependencies \[]:
  - [@&#8203;astrojs/markdown-remark](https://github.com/astrojs/markdown-remark)@&#8203;7.0.1

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My43Ni4yIiwidXBkYXRlZEluVmVyIjoiNDMuNzYuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->

Co-authored-by: Renovate Bot <renovate@zarantonello.dev>
Co-committed-by: Renovate Bot <renovate@zarantonello.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: astro Related to the core `astro` package (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants