Skip to content

Conversation

@matthewp
Copy link
Contributor

@matthewp matthewp commented Nov 26, 2025

Changes

  • Removes the platform proxy, uses request.cf and import { env } from 'cloudflare:workers' instead.

Testing

  • Cloudflare tests not all pass
  • The response from workerd is different in one of the test, updated that, but functionally the same.

Docs

N/A

@changeset-bot
Copy link

changeset-bot bot commented Nov 26, 2025

⚠️ No Changeset found

Latest commit: 1555879

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions bot added the pkg: integration Related to any renderer integration (scope) label Nov 26, 2025
@matthewp matthewp marked this pull request as ready for review November 28, 2025 14:46

export interface Runtime<T extends object = object> {
export interface Runtime {
runtime: {
Copy link
Member

Choose a reason for hiding this comment

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

I think we may want to change this object shape? locals.runtime.ctx may not make a lot of sense anymore. What about, idk, locals.cfContext?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought about something like that, but given that Astro.locals.runtime is already a existing object for the cloudflare integration and the variable is always documented as ctx I thought just making this as backwards compat as possible, for now, would be best.

Copy link
Member

@florian-lefebvre florian-lefebvre Nov 28, 2025

Choose a reason for hiding this comment

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

Given we remove all other properties already, not sure I agree. I'd say we should either keep everything and deprecate things if needed for backward compatibility, or start clean and design the API as we'd like it ideally

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok i switched to cfContext


injectTypes({
filename: 'cloudflare.d.ts',
content: '/// <reference types="@astrojs/cloudflare/types.d.ts" />',
Copy link
Member

Choose a reason for hiding this comment

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

You may need to update the package.json exports to make it work

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, thanks

@matthewp matthewp merged commit 3e172ef into feat/environment-api Nov 28, 2025
21 checks passed
@matthewp matthewp deleted the tests/env-cloudflare-2 branch November 28, 2025 16:40
ematipico added a commit that referenced this pull request Dec 4, 2025
Co-authored-by: Emanuele Stoppa <[email protected]>
Co-authored-by: Samuel Macleod <[email protected]>
Co-authored-by: Alexander Niebuhr <[email protected]>
Co-authored-by: ascorbic <[email protected]>
Co-authored-by: matthewp <[email protected]>
Co-authored-by: Florian Lefebvre <[email protected]>
Co-authored-by: Matt Kane <[email protected]>
Co-authored-by: florian-lefebvre <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Matthew Phillips <[email protected]>
Co-authored-by:  Matthew Phillips <[email protected]>
Co-authored-by: Sarah Rainsberger <[email protected]>
Co-authored-by: Erika <[email protected]>
Co-authored-by: Hayato Hasegawa <[email protected]>
fix: creation of routes list in build (#14325)
Fix unit tests for environment API (#14394)
fixture (#14599)
fix: organize imports and formatting in cloudflare handler (#14697)
fix: resolve environment-api build issues for client & CSS (#14770)
Fixes CSS when both static/client styles exist (#14790)
fix: flag `serverLike` incorrectly computed (#14792)
fix: redirects and i18n routing (#14797)
fix: logger level and static paths params (#14799)
Fix image tests crashing (#14803)
fix(environment): Error overlay not working (#14816)
fix: hashing of chunks (#14811)
Fix before-hydration script emission for environment-api (#14818)
fix: node leak into content collections (#14820)
fix: avoid `node:path` (#14827)
Fix API route tests (#14825)
Fix unit tests (#14832)
fix: server islands build (#14830)
Fix astro-component-bundling tests (#14840)
Fix astro-component-bundling tests (#14837)
Fix config alias by using resolve.alias config (#14828)
fix: container and routing tests (#14852)
fix: respect user vite config on sourcemaps (#14847)
fix: remove useless tests (#14854)
Fixes assetQueryParams and public folder tests (#14853)
fix: renderError fallback (#14855)
Fix server-islands data being used across tests (#14857)
fix: incorrect configuration in tests (#14858)
Fixes for tests in environment branch (#14865)
Fixes for e2e tests in environment branch (#14870)
fix(test): svelte async rendering (#14886)
fix(cloudflare/vercel/netlify): some tests pass and excluded others (#14892)
Fixes for node integrations tests (#14900)
Fix @astrojs/db tests (#14899)
fix(environment): Prevent Vite from interpreting injected sourcemap comments as actual sourcemaps (#14921)
Fix remaining cloudflare tests (#14912)
fix(vite): import mergeConfig from direct file to avoid dynamic import being processed by Vite (#14939)
Fix astro:env tests in Cloudflare (#14925)
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.

3 participants