MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / bootCloudflare

Function bootCloudflare

e2e/setup/cloudflare.boot.ts:26–70  ·  view source on GitHub ↗
(options: CloudflareBootOptions)

Source from the content-addressed store, hash-verified

24}
25
26export const bootCloudflare = async (options: CloudflareBootOptions): Promise<BootedProcesses> => {
27 if (!options.skipBuild) {
28 await promisify(execFile)("bun", ["run", "build"], { cwd: cloudflareDir });
29 }
30
31 const procs = bootProcesses(
32 [
33 {
34 // Run wrangler under Node, not Bun. Wrangler rejects the Bun runtime for
35 // workerd dev server websockets.
36 // dev-auth + the secret key arrive as `--var` overrides so the worker
37 // needs no Cloudflare account or real Access app.
38 cmd: process.env.E2E_NODE_BIN ?? "node",
39 args: [
40 wranglerBin,
41 "dev",
42 "--port",
43 String(options.port),
44 "--ip",
45 "127.0.0.1",
46 "--var",
47 "ENABLE_DEV_AUTH:true",
48 "--var",
49 "EXECUTOR_SECRET_KEY:e2e-secret-key-0123456789abcdef0123456789abcdef",
50 "--var",
51 "ALLOW_LOCAL_NETWORK:true",
52 ],
53 cwd: cloudflareDir,
54 env: { WRANGLER_SEND_METRICS: "false", CI: "true" },
55 logFile: options.logFile,
56 },
57 ],
58 { label: "cloudflare" },
59 );
60
61 try {
62 // dev-auth: /api/account/me answers 200 as the dev admin once the worker is
63 // up (workerd boot + esbuild + D1 schema bring-up take a beat on first run).
64 await waitForHttp(`http://127.0.0.1:${options.port}/api/account/me`, { timeoutMs: 120_000 });
65 } catch (error) {
66 await procs.teardown();
67 throw error;
68 }
69 return procs;
70};

Callers 1

setupFunction · 0.90

Calls 2

bootProcessesFunction · 0.90
waitForHttpFunction · 0.90

Tested by

no test coverage detected