sveltejs / sveltejs/kit

Why is `__vdpl` cookie used for Skew Protection in Vercel instead of `x-deployment-id` header?

Open
#12,592 16 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

pkg:adapter-vercel
Dominant language
JavaScript
Stars
20.8k
Forks
2.3k
Avg merge
1d 16h
Merged PRs (30d)
156

Description

Describe the problem

We're trying to understand why our app multiple times a day report the Failed to fetch dynamically imported module issue to Sentry.

It seems that this is caused by the user opening a new version of the app in a new tab, which is documented on SvelteKit docs:

Cookie-based skew protection comes with one caveat: if a user has multiple versions of your app open in multiple tabs, requests from older versions will be routed to the newer one, meaning they will fall back to SvelteKit's built-in skew protection.

I may be understanding this wrong, but wouldn't the x-deployment-id header make it so different application versions in different tabs would not be affected by the new cookie that is set? Instead of setting the cookie across all app versions, wouldn't each application be able to use the separate deployment ID's in the header from the server its connected to?

Describe the proposed solution

Using x-deployment-id header instead of __vdpl cookie.

Alternatives considered

SvelteKits internal Skew Protection will reload the page which "solves" the error, but why not let the application keep working with Vercel's Skew protection if it's enabled?

Importance

would make my life easier

Additional Information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files or tests. Start by comparing the documented cookie-based skew protection with SvelteKit's internal skew protection and the proposed x-deployment-id header approach; done would establish whether per-deployment routing can avoid cross-tab failures without breaking existing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
cloud, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.