Skip to content

fix(deploy): isolate Fastify startup and validate container readiness - #30

Merged
RlxChap2 merged 9 commits into
mainfrom
fix/cloudflare-worker-deploy
Oct 4, 2026
Merged

RlxChap2 merged 9 commits into
mainfrom
fix/cloudflare-worker-deploy

Conversation

@RlxChap2

@RlxChap2 RlxChap2 commented Oct 4, 2026 •

Copy link
Copy Markdown
Member

Fastify initialization at module scope left the Worker awaiting Avvio plugin boot during Cloudflare startup validation. The previous entrypoint reproduces Top-level await in module is unsettled locally in workerd. This change runs the existing Fastify API in a Node.js container and keeps the Worker entrypoint limited to request routing through a native Durable Object.

The Durable Object waits for /ready before forwarding the first request, shares initialization between concurrent requests, reapplies the inactivity timeout after re-instantiation, and checks readiness again after a container restart. Startup failures have a 30-second limit and a later request can retry. The Dockerfile uses its conventional filename and Wrangler loads src/worker.ts directly. Production pruning skips lifecycle scripts because prepare otherwise invokes Husky after its development dependency has been removed. CI reproduced that Docker build failure before this fix.

Validation:

  • Local ESLint, TypeScript build and all 141 tests passed.
  • Wrangler dry run passed; Worker bundle is 2.03 KiB.
  • pnpm cloudflare:startup starts the configured Worker in workerd successfully. It disables containers and checks Worker startup only.
  • GitHub CI passed on ffd85e5: Worker startup in workerd, production Docker image build, /health HTTP response, ESLint, TypeScript and all 141 tests with coverage. Docker execution ran on the Linux runner.

Workers Builds production settings:

Build command: pnpm run build
Deploy command: pnpm run deploy:cloudflare

A full Cloudflare deployment still requires the project's Containers configuration and credentials. Feature-branch container testing needs a separate staging Worker/environment with a full deploy. wrangler versions upload only uploads Worker code and does not publish container images. See Cloudflare container deployment documentation.
The Cloudflare Workers Builds check on the PR still reports failure and does not expose its detailed log through GitHub. Successful CI validates startup and the Docker image but does not prove a successful deployment to the production Cloudflare account.

@vercel

vercel Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
bonyan-api Ready Ready Preview Oct 4, 2026 5:57pm UTC

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Failed ❌

View logs ↗
ffd85e5 2026-10-04T17:57:08.291Z View logs ↗
  • Build: Failed ❌

View logs ↗
dc76f03 2026-10-04T17:55:33.115Z View logs ↗
  • Build: Failed ❌

View logs ↗
cd97d02 2026-10-04T17:53:45.289Z View logs ↗
  • Build: Failed ❌

View logs ↗
1065b14 2026-10-04T17:16:18.627Z View logs ↗
  • Build: Failed ❌

View logs ↗
51255a4 2026-10-04T17:09:25.144Z View logs ↗
  • Build: Failed ❌

View logs ↗
ce3cf7d 2026-10-04T16:50:48.772Z View logs ↗
  • Build: Failed ❌

View logs ↗
967cc6f 2026-10-04T16:48:03.437Z View logs ↗
  • Build: Failed ❌

View logs ↗
34225a9 2026-10-04T16:43:20.627Z View logs ↗

@RlxChap2 RlxChap2 changed the title fix(deploy): run Fastify API in Cloudflare Container fix(deploy): isolate Fastify startup and validate container readiness Oct 4, 2026
@RlxChap2
RlxChap2 merged commit f537016 into main Oct 4, 2026
4 of 5 checks passed
@RlxChap2
RlxChap2 deleted the fix/cloudflare-worker-deploy branch October 4, 2026 18:00

This branch was successfully deployed

1 active deployment
Preview — ffd85e52 Deployed Oct 4, 2026 by vercel[bot]
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.

1 participant