Skip to content

Conversation

@matthewp
Copy link
Contributor

Per request in Discord, adds errors to each of these getters instructing users what to use instead.

Changes

  • runtime.env -> import { env } from 'cloudflare:workers'
  • runtime.cf -> Astro.request.cf
  • runtime.caches -> global caches object
  • runtime.ctx -> Astro.locals.cfContext

Testing

N/A

Docs

N/A, already documented.

Adds helpful error messages when accessing removed runtime properties:
- runtime.env -> import { env } from 'cloudflare:workers'
- runtime.cf -> Astro.request.cf
- runtime.caches -> global caches object
- runtime.ctx -> Astro.locals.cfContext

Improves migration experience from v5 to v6.
@changeset-bot
Copy link

changeset-bot bot commented Dec 22, 2025

🦋 Changeset detected

Latest commit: ace91f0

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: integration Related to any renderer integration (scope) label Dec 22, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 22, 2025

⚠️ Package Trust Level Decreased

Caution

Decreased trust levels may indicate a higher risk of supply chain attacks. Please review these changes carefully.

📦 Package 🔒 Before 🔓 After
@cloudflare/unenv-preset trusted-with-provenance none
workerd trusted-with-provenance none
undici provenance none
miniflare trusted-with-provenance none
youch provenance none
@cloudflare/workerd-darwin-64 trusted-with-provenance none
@cloudflare/workerd-darwin-arm64 trusted-with-provenance none
@cloudflare/workerd-linux-64 trusted-with-provenance none
@cloudflare/workerd-linux-arm64 trusted-with-provenance none
@cloudflare/workerd-windows-64 trusted-with-provenance none
wrangler trusted-with-provenance none

Copy link
Member

@ArmandPhilippot ArmandPhilippot left a comment

Choose a reason for hiding this comment

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

LGTM! I left a suggestion for the changeset but feel free to discard, this is really a nit.

Are there other changes to Cloudflare that are not yet reflected in docs? I noticed we have some Astro.locals.runtime.env in the v6 docs (e.g. https://v6.docs.astro.build/en/guides/integrations-guide/cloudflare/#cloudflare-runtime). If this is the only change, I can make the update myself!

Edit:: Matt took care of this in withastro/docs#12981 🙌🏽

matthewp and others added 2 commits December 23, 2025 14:42
Co-authored-by: Armand Philippot <git@armand.philippot.eu>
- Remove runtime from Runtime interface to prevent autocomplete
- Use Object.defineProperty with enumerable: false
@matthewp matthewp merged commit ee2c260 into next Dec 30, 2025
22 checks passed
@matthewp matthewp deleted the local-runtime-warn branch December 30, 2025 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: integration Related to any renderer integration (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants