Skip to content

fix: skip non-upload-triggered worker versions in skew-protection#1270

Merged
james-elicx merged 1 commit into
opennextjs:mainfrom
alex-all3dp:dev/skew-protection-filter-non-upload-versions
May 18, 2026
Merged

fix: skip non-upload-triggered worker versions in skew-protection#1270
james-elicx merged 1 commit into
opennextjs:mainfrom
alex-all3dp:dev/skew-protection-filter-non-upload-versions

Conversation

@alex-all3dp
Copy link
Copy Markdown
Contributor

@alex-all3dp alex-all3dp commented May 18, 2026

Worker versions created by metadata-only operations (e.g. Cloudflare API secret updates with triggered_by=secret) do not include the static assets bundle. Previously, such a version could be picked as the "latest" target when replacing the "current" sentinel in the deployment mapping, causing /_next/static/* requests to return 404 on past deployments.

listWorkerVersions now skips versions whose metadata.annotations["workers/triggered_by"] is not in {upload, version_upload}. Versions with no annotation are kept for backward compatibility.

Closes #1230


Open in Devin Review

Worker versions created by metadata-only operations (e.g. Cloudflare API
secret updates with triggered_by=secret) do not include the static assets
bundle. Previously, such a version could be picked as the "latest" target
when replacing the "current" sentinel in the deployment mapping, causing
/_next/static/* requests to return 404 on past deployments.

listWorkerVersions now skips versions whose
metadata.annotations["workers/triggered_by"] is not in
{upload, version_upload}. Versions with no annotation are kept for
backward compatibility.

Closes opennextjs#1230
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 18, 2026

🦋 Changeset detected

Latest commit: 03c48e8

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

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 18, 2026

Open in StackBlitz

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

commit: 03c48e8

Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

const MS_PER_DAY = 24 * 3600 * 1000;

/** Worker-version trigger types that produce a full upload (assets + code). */
const UPLOAD_TRIGGER_TYPES = new Set(["upload", "version_upload"]);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@james-elicx james-elicx merged commit 802047e into opennextjs:main May 18, 2026
8 checks passed
@alex-all3dp alex-all3dp deleted the dev/skew-protection-filter-non-upload-versions branch May 19, 2026 08:20
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.

Skew protection can map previous deployments to asset-less worker versions

2 participants