Repository navigation
Remove Cloudflare Pages Functions from website stack #282
Description
Context
PR #281 restored the homepage by adding a temporary root Pages Function fallback. That fixed the production outage, but it means homepage requests invoke the Pages Functions runtime. We should remove Pages Functions from the website stack and make the Astro site pure static again.
Production also had Cloudflare Web Analytics injection enabled. The homepage stayed 500 after the merge until Web Analytics was disabled and the production deployment was retried. That setting should remain off unless we can prove it no longer breaks homepage HTML serving.
Target state
operately.comis served as static Astro assets only.- No
functions/directory in this repository. - No
_routes.jsonneeded for Pages Functions routing. - Contact form submits to an API endpoint outside the Pages static site.
- Homepage and contact form behavior are verified on both preview and production URLs before removing the fallback.
Proposed plan
-
Move contact handling out of Cloudflare Pages Functions.
- Preferred: create a separate Worker, e.g.
contact.operately.comorapi.operately.com/contact. - Alternative: send contact form submissions to an existing backend endpoint if one is already appropriate.
- Keep SendGrid secrets in the destination service, not in the website Pages project.
- Preferred: create a separate Worker, e.g.
-
Update the website contact form.
- Replace
/api/contactwith the new absolute API URL. - Confirm CORS, method handling, JSON validation, and error responses.
- Add/update a focused test or manual verification script for successful and malformed submissions.
- Replace
-
Remove Pages Functions from this repo.
- Delete
functions/api/contact.ts. - Delete temporary
functions/index.ts. - Delete
public/_routes.json. - Keep
src/pages/home.astroonly if still needed for investigation; otherwise collapseHomePage.astroback into normal homepage structure or leave it as a harmless component extraction.
- Delete
-
Validate Cloudflare Pages as pure static.
- Deploy a preview with no
functions/directory. - Verify:
curl -I https://<preview>.operately-website.pages.dev/returns 200.curl -I https://<preview>.operately-website.pages.dev/contact/returns 200.- Contact form posts successfully to the new external API.
- Merge and verify production
https://operately.com/returns 200.
- Deploy a preview with no
-
Keep Cloudflare Web Analytics disabled for now.
- If analytics are needed, reintroduce via explicit app-side analytics code or test Cloudflare Web Analytics in a preview/staging project first.
- Do not re-enable Pages Web Analytics on production until homepage static serving is verified after a fresh production deploy.
Exit criteria
- The website Pages project reports
uses_functions: falseon the latest production deployment. https://operately.com/returns 200 without a root Pages Function.- Contact submissions still work through the replacement endpoint.
- Cloudflare Pages Web Analytics remains disabled or has a documented, tested replacement.
Activity