pi-cloudflare 0.10.2 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +78 -180
- package/package.json +7 -42
- package/plugin.json +3 -3
- package/skills/agents-sdk/SKILL.md +17 -36
- package/skills/agents-sdk/references/client-sdk.md +7 -106
- package/skills/agents-sdk/references/human-in-the-loop.md +6 -63
- package/skills/agents-sdk/references/mcp.md +9 -184
- package/skills/agents-sdk/references/queue-retries.md +12 -73
- package/skills/agents-sdk/references/server-driven-messages.md +4 -60
- package/skills/agents-sdk/references/state-scheduling.md +10 -166
- package/skills/agents-sdk/references/streaming-chat.md +11 -193
- package/skills/agents-sdk/references/webhooks-push.md +2 -2
- package/skills/agents-sdk/references/workflows.md +14 -125
- package/skills/cloudflare/SKILL.md +135 -248
- package/skills/cloudflare/references/ai-gateway/README.md +17 -165
- package/skills/cloudflare/references/ai-gateway/configuration.md +14 -107
- package/skills/cloudflare/references/ai-gateway/dynamic-routing.md +12 -79
- package/skills/cloudflare/references/ai-gateway/features.md +22 -96
- package/skills/cloudflare/references/ai-gateway/sdk-integration.md +17 -112
- package/skills/cloudflare/references/ai-gateway/troubleshooting.md +14 -86
- package/skills/cloudflare/references/ai-search/README.md +17 -130
- package/skills/cloudflare/references/ai-search/api.md +10 -84
- package/skills/cloudflare/references/ai-search/configuration.md +16 -88
- package/skills/cloudflare/references/ai-search/gotchas.md +13 -81
- package/skills/cloudflare/references/ai-search/patterns.md +12 -82
- package/skills/cloudflare/references/analytics-engine/api.md +1 -1
- package/skills/cloudflare/references/api/README.md +2 -2
- package/skills/cloudflare/references/api/configuration.md +1 -1
- package/skills/cloudflare/references/bindings/README.md +11 -117
- package/skills/cloudflare/references/bindings/api.md +17 -201
- package/skills/cloudflare/references/bindings/configuration.md +20 -188
- package/skills/cloudflare/references/bindings/gotchas.md +16 -206
- package/skills/cloudflare/references/bindings/patterns.md +15 -195
- package/skills/cloudflare/references/bot-management/README.md +1 -1
- package/skills/cloudflare/references/browser-rendering/README.md +13 -73
- package/skills/cloudflare/references/browser-rendering/api.md +9 -105
- package/skills/cloudflare/references/browser-rendering/configuration.md +9 -75
- package/skills/cloudflare/references/browser-rendering/gotchas.md +12 -85
- package/skills/cloudflare/references/browser-rendering/patterns.md +9 -88
- package/skills/cloudflare/references/c3/README.md +6 -5
- package/skills/cloudflare/references/c3/api.md +3 -4
- package/skills/cloudflare/references/c3/patterns.md +4 -6
- package/skills/cloudflare/references/cache-reserve/README.md +1 -1
- package/skills/cloudflare/references/containers/README.md +15 -77
- package/skills/cloudflare/references/containers/api.md +13 -187
- package/skills/cloudflare/references/containers/configuration.md +15 -188
- package/skills/cloudflare/references/containers/gotchas.md +16 -178
- package/skills/cloudflare/references/containers/patterns.md +14 -198
- package/skills/cloudflare/references/cron-triggers/README.md +13 -92
- package/skills/cloudflare/references/cron-triggers/api.md +11 -191
- package/skills/cloudflare/references/cron-triggers/configuration.md +11 -175
- package/skills/cloudflare/references/cron-triggers/gotchas.md +13 -195
- package/skills/cloudflare/references/cron-triggers/patterns.md +12 -184
- package/skills/cloudflare/references/d1/README.md +9 -127
- package/skills/cloudflare/references/d1/api.md +16 -194
- package/skills/cloudflare/references/d1/configuration.md +16 -189
- package/skills/cloudflare/references/d1/gotchas.md +16 -96
- package/skills/cloudflare/references/d1/patterns.md +14 -183
- package/skills/cloudflare/references/do-storage/README.md +11 -70
- package/skills/cloudflare/references/do-storage/api.md +11 -99
- package/skills/cloudflare/references/do-storage/configuration.md +11 -107
- package/skills/cloudflare/references/do-storage/gotchas.md +12 -147
- package/skills/cloudflare/references/do-storage/patterns.md +11 -190
- package/skills/cloudflare/references/do-storage/testing.md +8 -178
- package/skills/cloudflare/references/email-routing/README.md +14 -84
- package/skills/cloudflare/references/email-routing/api.md +10 -192
- package/skills/cloudflare/references/email-routing/configuration.md +13 -186
- package/skills/cloudflare/references/email-routing/gotchas.md +12 -193
- package/skills/cloudflare/references/email-routing/patterns.md +10 -226
- package/skills/cloudflare/references/email-workers/README.md +13 -146
- package/skills/cloudflare/references/email-workers/api.md +12 -234
- package/skills/cloudflare/references/email-workers/configuration.md +14 -110
- package/skills/cloudflare/references/email-workers/gotchas.md +15 -125
- package/skills/cloudflare/references/email-workers/patterns.md +14 -100
- package/skills/cloudflare/references/flagship/README.md +2 -2
- package/skills/cloudflare/references/hyperdrive/README.md +17 -72
- package/skills/cloudflare/references/hyperdrive/api.md +19 -136
- package/skills/cloudflare/references/hyperdrive/configuration.md +27 -159
- package/skills/cloudflare/references/hyperdrive/gotchas.md +15 -72
- package/skills/cloudflare/references/hyperdrive/patterns.md +12 -187
- package/skills/cloudflare/references/images/README.md +9 -58
- package/skills/cloudflare/references/images/api.md +13 -96
- package/skills/cloudflare/references/images/configuration.md +17 -211
- package/skills/cloudflare/references/images/gotchas.md +16 -99
- package/skills/cloudflare/references/images/patterns.md +16 -115
- package/skills/cloudflare/references/kv/README.md +9 -83
- package/skills/cloudflare/references/kv/api.md +12 -154
- package/skills/cloudflare/references/kv/configuration.md +11 -139
- package/skills/cloudflare/references/kv/gotchas.md +15 -129
- package/skills/cloudflare/references/kv/patterns.md +15 -190
- package/skills/cloudflare/references/miniflare/README.md +15 -98
- package/skills/cloudflare/references/miniflare/api.md +16 -187
- package/skills/cloudflare/references/miniflare/configuration.md +12 -169
- package/skills/cloudflare/references/miniflare/gotchas.md +15 -160
- package/skills/cloudflare/references/miniflare/patterns.md +15 -177
- package/skills/cloudflare/references/network-interconnect/README.md +1 -1
- package/skills/cloudflare/references/network-interconnect/gotchas.md +1 -1
- package/skills/cloudflare/references/network-interconnect/patterns.md +1 -1
- package/skills/cloudflare/references/observability/README.md +20 -81
- package/skills/cloudflare/references/observability/api.md +20 -164
- package/skills/cloudflare/references/observability/configuration.md +18 -164
- package/skills/cloudflare/references/observability/gotchas.md +19 -109
- package/skills/cloudflare/references/observability/patterns.md +12 -103
- package/skills/cloudflare/references/pages/README.md +13 -81
- package/skills/cloudflare/references/pages/api.md +10 -201
- package/skills/cloudflare/references/pages/configuration.md +16 -201
- package/skills/cloudflare/references/pages/gotchas.md +13 -197
- package/skills/cloudflare/references/pages/patterns.md +11 -200
- package/skills/cloudflare/references/pages-functions/README.md +13 -91
- package/skills/cloudflare/references/pages-functions/api.md +10 -140
- package/skills/cloudflare/references/pages-functions/configuration.md +11 -119
- package/skills/cloudflare/references/pages-functions/gotchas.md +17 -94
- package/skills/cloudflare/references/pages-functions/patterns.md +12 -133
- package/skills/cloudflare/references/pipelines/README.md +1 -1
- package/skills/cloudflare/references/pulumi/README.md +2 -2
- package/skills/cloudflare/references/queues/README.md +15 -87
- package/skills/cloudflare/references/queues/api.md +10 -200
- package/skills/cloudflare/references/queues/configuration.md +18 -142
- package/skills/cloudflare/references/queues/gotchas.md +16 -204
- package/skills/cloudflare/references/queues/patterns.md +19 -218
- package/skills/cloudflare/references/r2/README.md +17 -86
- package/skills/cloudflare/references/r2/api.md +14 -198
- package/skills/cloudflare/references/r2/configuration.md +17 -163
- package/skills/cloudflare/references/r2/gotchas.md +15 -188
- package/skills/cloudflare/references/r2/patterns.md +16 -191
- package/skills/cloudflare/references/r2-data-catalog/README.md +11 -70
- package/skills/cloudflare/references/r2-data-catalog/api.md +14 -89
- package/skills/cloudflare/references/r2-data-catalog/configuration.md +15 -96
- package/skills/cloudflare/references/r2-data-catalog/gotchas.md +14 -51
- package/skills/cloudflare/references/r2-data-catalog/patterns.md +11 -116
- package/skills/cloudflare/references/realtime-sfu/README.md +1 -1
- package/skills/cloudflare/references/realtimekit/README.md +1 -1
- package/skills/cloudflare/references/secrets-store/README.md +14 -66
- package/skills/cloudflare/references/secrets-store/api.md +14 -193
- package/skills/cloudflare/references/secrets-store/configuration.md +16 -176
- package/skills/cloudflare/references/secrets-store/gotchas.md +14 -92
- package/skills/cloudflare/references/secrets-store/patterns.md +14 -194
- package/skills/cloudflare/references/smart-placement/README.md +2 -2
- package/skills/cloudflare/references/static-assets/README.md +15 -59
- package/skills/cloudflare/references/static-assets/api.md +12 -195
- package/skills/cloudflare/references/static-assets/configuration.md +16 -186
- package/skills/cloudflare/references/static-assets/gotchas.md +18 -162
- package/skills/cloudflare/references/static-assets/patterns.md +13 -185
- package/skills/cloudflare/references/stream/README.md +15 -107
- package/skills/cloudflare/references/stream/api-live.md +16 -193
- package/skills/cloudflare/references/stream/api.md +19 -197
- package/skills/cloudflare/references/stream/configuration.md +16 -139
- package/skills/cloudflare/references/stream/gotchas.md +16 -128
- package/skills/cloudflare/references/stream/patterns.md +20 -182
- package/skills/cloudflare/references/tail-workers/README.md +14 -82
- package/skills/cloudflare/references/tail-workers/api.md +10 -197
- package/skills/cloudflare/references/tail-workers/configuration.md +13 -174
- package/skills/cloudflare/references/tail-workers/gotchas.md +12 -188
- package/skills/cloudflare/references/tail-workers/patterns.md +11 -176
- package/skills/cloudflare/references/terraform/README.md +2 -2
- package/skills/cloudflare/references/tunnel/README.md +13 -122
- package/skills/cloudflare/references/tunnel/api.md +11 -190
- package/skills/cloudflare/references/tunnel/configuration.md +12 -155
- package/skills/cloudflare/references/tunnel/gotchas.md +12 -144
- package/skills/cloudflare/references/tunnel/networking.md +12 -166
- package/skills/cloudflare/references/tunnel/patterns.md +12 -189
- package/skills/cloudflare/references/vectorize/README.md +15 -126
- package/skills/cloudflare/references/vectorize/api.md +14 -84
- package/skills/cloudflare/references/vectorize/configuration.md +14 -83
- package/skills/cloudflare/references/vectorize/gotchas.md +12 -73
- package/skills/cloudflare/references/vectorize/patterns.md +17 -83
- package/skills/cloudflare/references/waf/README.md +15 -107
- package/skills/cloudflare/references/waf/api.md +17 -202
- package/skills/cloudflare/references/waf/configuration.md +14 -199
- package/skills/cloudflare/references/waf/gotchas.md +15 -200
- package/skills/cloudflare/references/waf/patterns.md +13 -193
- package/skills/cloudflare/references/workerd/README.md +2 -2
- package/skills/cloudflare/references/workers-ai/README.md +14 -187
- package/skills/cloudflare/references/workers-ai/api.md +10 -109
- package/skills/cloudflare/references/workers-ai/configuration.md +11 -92
- package/skills/cloudflare/references/workers-ai/gotchas.md +12 -111
- package/skills/cloudflare/references/workers-ai/patterns.md +9 -115
- package/skills/cloudflare/references/workers-for-platforms/README.md +3 -3
- package/skills/cloudflare/references/workers-vpc/README.md +1 -1
- package/skills/cloudflare/references/workflows/README.md +15 -69
- package/skills/cloudflare/references/workflows/api.md +12 -213
- package/skills/cloudflare/references/workflows/configuration.md +16 -150
- package/skills/cloudflare/references/workflows/gotchas.md +17 -88
- package/skills/cloudflare/references/workflows/patterns.md +19 -164
- package/skills/cloudflare-api-token/SKILL.md +1 -1
- package/skills/cloudflare-cf-cli/SKILL.md +44 -13
- package/skills/cloudflare-email-service/SKILL.md +6 -36
- package/skills/cloudflare-email-service/references/rest-api.md +12 -179
- package/skills/cloudflare-email-service/references/sending.md +17 -250
- package/skills/cloudflare-one/SKILL.md +4 -2
- package/skills/cloudflare-one-migrations/SKILL.md +1 -1
- package/skills/cloudflare-token-roll/SKILL.md +2 -5
- package/skills/durable-objects/SKILL.md +10 -16
- package/skills/durable-objects/references/rules.md +17 -293
- package/skills/durable-objects/references/testing.md +16 -257
- package/skills/nextjs-on-cloudflare/SKILL.md +33 -0
- package/skills/sandbox-migrate-to-next/SKILL.md +2 -2
- package/skills/sandbox-next/SKILL.md +3 -2
- package/skills/sandbox-next/references/api-quick-ref.md +15 -90
- package/skills/sandbox-stable/SKILL.md +1 -1
- package/skills/turnstile-spin/SKILL.md +14 -8
- package/skills/workers-best-practices/SKILL.md +36 -103
- package/skills/workers-best-practices/references/configuration.md +139 -0
- package/skills/workers-best-practices/references/platform-apis.md +51 -0
- package/skills/workers-best-practices/references/{rules.md → runtime-patterns.md} +9 -134
- package/skills/wrangler/SKILL.md +48 -901
- package/bin/setup.mjs +0 -119
- package/dist/api-token.d.ts +0 -12
- package/dist/api-token.d.ts.map +0 -1
- package/dist/api-token.js +0 -23
- package/dist/api-token.js.map +0 -1
- package/dist/auth-flow.d.ts +0 -15
- package/dist/auth-flow.d.ts.map +0 -1
- package/dist/auth-flow.js +0 -90
- package/dist/auth-flow.js.map +0 -1
- package/dist/client.d.ts +0 -18
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -47
- package/dist/client.js.map +0 -1
- package/dist/config.d.ts +0 -20
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -10
- package/dist/config.js.map +0 -1
- package/dist/index.d.ts +0 -22
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -65
- package/dist/index.js.map +0 -1
- package/dist/mcp-server.d.ts +0 -2
- package/dist/mcp-server.d.ts.map +0 -1
- package/dist/mcp-server.js +0 -106
- package/dist/mcp-server.js.map +0 -1
- package/dist/oauth.d.ts +0 -44
- package/dist/oauth.d.ts.map +0 -1
- package/dist/oauth.js +0 -135
- package/dist/oauth.js.map +0 -1
- package/dist/proxy.d.ts +0 -30
- package/dist/proxy.d.ts.map +0 -1
- package/dist/proxy.js +0 -41
- package/dist/proxy.js.map +0 -1
- package/dist/result-caps.d.ts +0 -23
- package/dist/result-caps.d.ts.map +0 -1
- package/dist/result-caps.js +0 -75
- package/dist/result-caps.js.map +0 -1
- package/dist/runtime.d.ts +0 -72
- package/dist/runtime.d.ts.map +0 -1
- package/dist/runtime.js +0 -249
- package/dist/runtime.js.map +0 -1
- package/dist/servers.d.ts +0 -19
- package/dist/servers.d.ts.map +0 -1
- package/dist/servers.js +0 -40
- package/dist/servers.js.map +0 -1
- package/dist/token-store.d.ts +0 -32
- package/dist/token-store.d.ts.map +0 -1
- package/dist/token-store.js +0 -61
- package/dist/token-store.js.map +0 -1
- package/dist/tool-cache.d.ts +0 -25
- package/dist/tool-cache.d.ts.map +0 -1
- package/dist/tool-cache.js +0 -43
- package/dist/tool-cache.js.map +0 -1
- package/mcp.json +0 -15
- package/skills/cloudflare/references/agents-sdk/README.md +0 -89
- package/skills/cloudflare/references/agents-sdk/api.md +0 -190
- package/skills/cloudflare/references/agents-sdk/configuration.md +0 -182
- package/skills/cloudflare/references/agents-sdk/gotchas.md +0 -158
- package/skills/cloudflare/references/agents-sdk/patterns.md +0 -192
- package/skills/cloudflare/references/durable-objects/README.md +0 -185
- package/skills/cloudflare/references/durable-objects/api.md +0 -187
- package/skills/cloudflare/references/durable-objects/configuration.md +0 -160
- package/skills/cloudflare/references/durable-objects/gotchas.md +0 -197
- package/skills/cloudflare/references/durable-objects/patterns.md +0 -201
- package/skills/cloudflare/references/sandbox/README.md +0 -96
- package/skills/cloudflare/references/sandbox/api.md +0 -198
- package/skills/cloudflare/references/sandbox/configuration.md +0 -143
- package/skills/cloudflare/references/sandbox/gotchas.md +0 -194
- package/skills/cloudflare/references/sandbox/patterns.md +0 -201
- package/skills/cloudflare/references/turnstile/README.md +0 -99
- package/skills/cloudflare/references/turnstile/api.md +0 -240
- package/skills/cloudflare/references/turnstile/configuration.md +0 -222
- package/skills/cloudflare/references/turnstile/gotchas.md +0 -218
- package/skills/cloudflare/references/turnstile/patterns.md +0 -193
- package/skills/cloudflare/references/workers/README.md +0 -108
- package/skills/cloudflare/references/workers/api.md +0 -195
- package/skills/cloudflare/references/workers/configuration.md +0 -185
- package/skills/cloudflare/references/workers/frameworks.md +0 -197
- package/skills/cloudflare/references/workers/gotchas.md +0 -137
- package/skills/cloudflare/references/workers/patterns.md +0 -198
- package/skills/cloudflare/references/wrangler/README.md +0 -135
- package/skills/cloudflare/references/wrangler/api.md +0 -188
- package/skills/cloudflare/references/wrangler/configuration.md +0 -197
- package/skills/cloudflare/references/wrangler/gotchas.md +0 -197
- package/skills/cloudflare/references/wrangler/patterns.md +0 -209
- package/skills/cloudflare-auth-setup/SKILL.md +0 -59
- package/skills/workers-best-practices/references/review.md +0 -174
|
@@ -1,187 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
onStart() { /* container started */ }
|
|
16
|
-
onStop() { /* container stopping */ }
|
|
17
|
-
onError(error: Error) { /* container error */ }
|
|
18
|
-
onActivityExpired(): boolean { /* timeout, return true to stay alive */ }
|
|
19
|
-
async alarm() { /* scheduled task */ }
|
|
20
|
-
}
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Routing
|
|
24
|
-
|
|
25
|
-
**getByName(id)** - Named instance for session affinity, per-user state
|
|
26
|
-
**getRandom()** - Random instance for load balancing stateless services
|
|
27
|
-
|
|
28
|
-
```typescript
|
|
29
|
-
const container = env.MY_CONTAINER.getByName("user-123");
|
|
30
|
-
const container = env.MY_CONTAINER.getRandom();
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## Startup Methods
|
|
34
|
-
|
|
35
|
-
### start() - Basic start (8s timeout)
|
|
36
|
-
|
|
37
|
-
```typescript
|
|
38
|
-
await container.start();
|
|
39
|
-
await container.start({ envVars: { KEY: "value" } });
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
Returns when **process starts**, NOT when ports ready. Use for fire-and-forget.
|
|
43
|
-
|
|
44
|
-
### startAndWaitForPorts() - Recommended (20s timeout)
|
|
45
|
-
|
|
46
|
-
```typescript
|
|
47
|
-
await container.startAndWaitForPorts(); // Uses requiredPorts
|
|
48
|
-
await container.startAndWaitForPorts({ ports: [8080, 9090] });
|
|
49
|
-
await container.startAndWaitForPorts({
|
|
50
|
-
ports: [8080],
|
|
51
|
-
startOptions: { envVars: { KEY: "value" } }
|
|
52
|
-
});
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
Returns when **ports listening**. Use before HTTP/TCP requests.
|
|
56
|
-
|
|
57
|
-
**Port resolution:** explicit ports → requiredPorts → defaultPort → port 33
|
|
58
|
-
|
|
59
|
-
### waitForPort() - Wait for specific port
|
|
60
|
-
|
|
61
|
-
```typescript
|
|
62
|
-
await container.waitForPort(8080);
|
|
63
|
-
await container.waitForPort(8080, { timeout: 30000 });
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
## Communication
|
|
67
|
-
|
|
68
|
-
### fetch() - HTTP with WebSocket support
|
|
69
|
-
|
|
70
|
-
```typescript
|
|
71
|
-
// ✅ Supports WebSocket upgrades
|
|
72
|
-
const response = await container.fetch(request);
|
|
73
|
-
const response = await container.fetch("http://container/api", {
|
|
74
|
-
method: "POST",
|
|
75
|
-
body: JSON.stringify({ data: "value" })
|
|
76
|
-
});
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
**Use for:** All HTTP, especially WebSocket.
|
|
80
|
-
|
|
81
|
-
### containerFetch() - HTTP only (no WebSocket)
|
|
82
|
-
|
|
83
|
-
```typescript
|
|
84
|
-
// ❌ No WebSocket support
|
|
85
|
-
const response = await container.containerFetch(request);
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
**⚠️ Critical:** Use `fetch()` for WebSocket, not `containerFetch()`.
|
|
89
|
-
|
|
90
|
-
### TCP Connections
|
|
91
|
-
|
|
92
|
-
```typescript
|
|
93
|
-
const port = this.ctx.container.getTcpPort(8080);
|
|
94
|
-
const conn = port.connect();
|
|
95
|
-
await conn.opened;
|
|
96
|
-
|
|
97
|
-
if (request.body) await request.body.pipeTo(conn.writable);
|
|
98
|
-
return new Response(conn.readable);
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
### switchPort() - Change default port
|
|
102
|
-
|
|
103
|
-
```typescript
|
|
104
|
-
this.switchPort(8081); // Subsequent fetch() uses this port
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
## Lifecycle Hooks
|
|
108
|
-
|
|
109
|
-
### onStart()
|
|
110
|
-
|
|
111
|
-
Called when container process starts (ports may not be ready). Runs in `blockConcurrencyWhile` - no concurrent requests.
|
|
112
|
-
|
|
113
|
-
```typescript
|
|
114
|
-
onStart() {
|
|
115
|
-
console.log("Container starting");
|
|
116
|
-
}
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
### onStop()
|
|
120
|
-
|
|
121
|
-
Called when SIGTERM received. 15 minutes until SIGKILL. Use for graceful shutdown.
|
|
122
|
-
|
|
123
|
-
```typescript
|
|
124
|
-
onStop() {
|
|
125
|
-
// Save state, close connections, flush logs
|
|
126
|
-
}
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
### onError()
|
|
130
|
-
|
|
131
|
-
Called when container crashes or fails to start.
|
|
132
|
-
|
|
133
|
-
```typescript
|
|
134
|
-
onError(error: Error) {
|
|
135
|
-
console.error("Container error:", error);
|
|
136
|
-
}
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
### onActivityExpired()
|
|
140
|
-
|
|
141
|
-
Called when `sleepAfter` timeout reached. Return `true` to stay alive, `false` to stop.
|
|
142
|
-
|
|
143
|
-
```typescript
|
|
144
|
-
onActivityExpired(): boolean {
|
|
145
|
-
if (this.hasActiveConnections()) return true; // Keep alive
|
|
146
|
-
return false; // OK to stop
|
|
147
|
-
}
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
## Scheduling
|
|
151
|
-
|
|
152
|
-
```typescript
|
|
153
|
-
export class ScheduledContainer extends Container {
|
|
154
|
-
async fetch(request: Request) {
|
|
155
|
-
await this.schedule(Date.now() + 60000); // 1 minute
|
|
156
|
-
await this.schedule("2026-01-28T00:00:00Z"); // ISO string
|
|
157
|
-
return new Response("Scheduled");
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
async alarm() {
|
|
161
|
-
// Called when schedule fires (SQLite-backed, survives restarts)
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
**⚠️ Don't override `alarm()` directly when using `schedule()` helper.**
|
|
167
|
-
|
|
168
|
-
## State Inspection
|
|
169
|
-
|
|
170
|
-
### External state check
|
|
171
|
-
|
|
172
|
-
```typescript
|
|
173
|
-
const state = await container.getState();
|
|
174
|
-
// state.status: "starting" | "running" | "stopping" | "stopped"
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
### Internal state check
|
|
178
|
-
|
|
179
|
-
```typescript
|
|
180
|
-
export class MyContainer extends Container {
|
|
181
|
-
async fetch(request: Request) {
|
|
182
|
-
if (this.ctx.container.running) { ... }
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
**⚠️ Use `getState()` for external checks, `ctx.container.running` for internal.**
|
|
1
|
+
# Containers API
|
|
2
|
+
|
|
3
|
+
Use the [Container interface](https://developers.cloudflare.com/containers/reference/container-class/) for the current SDK methods, signatures, properties, and examples. Use the [Durable Object Container API](https://developers.cloudflare.com/durable-objects/api/container/) when working directly with the runtime rather than the SDK class.
|
|
4
|
+
|
|
5
|
+
| Task | Documentation |
|
|
6
|
+
| --- | --- |
|
|
7
|
+
| Forward HTTP or WebSocket requests | [Request methods](https://developers.cloudflare.com/containers/reference/container-class/#request-methods) |
|
|
8
|
+
| Start a process, wait for ports, stop, or destroy it | [Start and stop](https://developers.cloudflare.com/containers/reference/container-class/#start-and-stop) |
|
|
9
|
+
| React to startup, exit, errors, or idle expiry | [Lifecycle hooks](https://developers.cloudflare.com/containers/reference/container-class/#lifecycle-hooks) |
|
|
10
|
+
| Inspect state or keep background work active | [State and monitoring](https://developers.cloudflare.com/containers/reference/container-class/#state-and-monitoring) |
|
|
11
|
+
| Schedule callbacks without replacing the SDK's alarm handler | [Scheduling](https://developers.cloudflare.com/containers/reference/container-class/#scheduling) |
|
|
12
|
+
| Address named instances, select stateless instances, or switch request ports | [Utility functions](https://developers.cloudflare.com/containers/reference/container-class/#utility-functions) |
|
|
13
|
+
| Communicate over TCP from a Durable Object | [TCP port API](https://developers.cloudflare.com/durable-objects/api/container/#gettcpport) |
|
|
@@ -1,188 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
],
|
|
18
|
-
"durable_objects": {
|
|
19
|
-
"bindings": [
|
|
20
|
-
{
|
|
21
|
-
"name": "MY_CONTAINER",
|
|
22
|
-
"class_name": "MyContainer"
|
|
23
|
-
}
|
|
24
|
-
]
|
|
25
|
-
},
|
|
26
|
-
"migrations": [
|
|
27
|
-
{
|
|
28
|
-
"tag": "v1",
|
|
29
|
-
"new_sqlite_classes": ["MyContainer"] // Must use new_sqlite_classes
|
|
30
|
-
}
|
|
31
|
-
]
|
|
32
|
-
}
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
Key config requirements:
|
|
36
|
-
- `image` - Path to Dockerfile or directory containing Dockerfile
|
|
37
|
-
- `class_name` - Must match Container class export name
|
|
38
|
-
- `max_instances` - Max concurrent container instances
|
|
39
|
-
- Must configure Durable Objects binding AND migrations
|
|
40
|
-
|
|
41
|
-
### Instance Types
|
|
42
|
-
|
|
43
|
-
#### Predefined Types
|
|
44
|
-
|
|
45
|
-
| Type | vCPU | Memory | Disk |
|
|
46
|
-
|------|------|--------|------|
|
|
47
|
-
| lite | 1/16 | 256 MiB | 2 GB |
|
|
48
|
-
| basic | 1/4 | 1 GiB | 4 GB |
|
|
49
|
-
| standard-1 | 1/2 | 4 GiB | 8 GB |
|
|
50
|
-
| standard-2 | 1 | 6 GiB | 12 GB |
|
|
51
|
-
| standard-3 | 2 | 8 GiB | 16 GB |
|
|
52
|
-
| standard-4 | 4 | 12 GiB | 20 GB |
|
|
53
|
-
|
|
54
|
-
```jsonc
|
|
55
|
-
{
|
|
56
|
-
"containers": [
|
|
57
|
-
{
|
|
58
|
-
"class_name": "MyContainer",
|
|
59
|
-
"image": "./Dockerfile",
|
|
60
|
-
"instance_type": "standard-2" // Use predefined type
|
|
61
|
-
}
|
|
62
|
-
]
|
|
63
|
-
}
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
#### Custom Types (Jan 2026 Feature)
|
|
67
|
-
|
|
68
|
-
```jsonc
|
|
69
|
-
{
|
|
70
|
-
"containers": [
|
|
71
|
-
{
|
|
72
|
-
"class_name": "MyContainer",
|
|
73
|
-
"image": "./Dockerfile",
|
|
74
|
-
"instance_type_custom": {
|
|
75
|
-
"vcpu": 2, // 1-4 vCPU
|
|
76
|
-
"memory_mib": 8192, // 512-12288 MiB (up to 12 GiB)
|
|
77
|
-
"disk_mib": 16384 // 2048-20480 MiB (up to 20 GB)
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
]
|
|
81
|
-
}
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
**Custom type constraints:**
|
|
85
|
-
- Minimum 3 GiB memory per vCPU
|
|
86
|
-
- Maximum 2 GB disk per 1 GiB memory
|
|
87
|
-
- Max 4 vCPU, 12 GiB memory, 20 GB disk per container
|
|
88
|
-
|
|
89
|
-
### Account Limits
|
|
90
|
-
|
|
91
|
-
| Resource | Limit | Notes |
|
|
92
|
-
|----------|-------|-------|
|
|
93
|
-
| Total memory (all containers) | 400 GiB | Across all running containers |
|
|
94
|
-
| Total vCPU (all containers) | 100 | Across all running containers |
|
|
95
|
-
| Total disk (all containers) | 2 TB | Across all running containers |
|
|
96
|
-
| Image storage per account | 50 GB | Stored container images |
|
|
97
|
-
|
|
98
|
-
### Container Class Properties
|
|
99
|
-
|
|
100
|
-
```typescript
|
|
101
|
-
import { Container } from "@cloudflare/containers";
|
|
102
|
-
|
|
103
|
-
export class MyContainer extends Container {
|
|
104
|
-
// Port Configuration
|
|
105
|
-
defaultPort = 8080; // Default port for fetch() calls
|
|
106
|
-
requiredPorts = [8080, 9090]; // Ports to wait for in startAndWaitForPorts()
|
|
107
|
-
|
|
108
|
-
// Lifecycle
|
|
109
|
-
sleepAfter = "30m"; // Inactivity timeout (5m, 30m, 2h, etc.)
|
|
110
|
-
|
|
111
|
-
// Network
|
|
112
|
-
enableInternet = true; // Allow outbound internet access
|
|
113
|
-
|
|
114
|
-
// Health Check
|
|
115
|
-
pingEndpoint = "/health"; // Health check endpoint path
|
|
116
|
-
|
|
117
|
-
// Environment
|
|
118
|
-
envVars = { // Environment variables passed to container
|
|
119
|
-
NODE_ENV: "production",
|
|
120
|
-
LOG_LEVEL: "info"
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
// Startup
|
|
124
|
-
entrypoint = ["/bin/start.sh"]; // Override image entrypoint (optional)
|
|
125
|
-
}
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
**Property details:**
|
|
129
|
-
|
|
130
|
-
- **`defaultPort`**: Port used when calling `container.fetch()` without explicit port. Falls back to port 33 if not set.
|
|
131
|
-
|
|
132
|
-
- **`requiredPorts`**: Array of ports that must be listening before `startAndWaitForPorts()` returns. First port becomes default if `defaultPort` not set.
|
|
133
|
-
|
|
134
|
-
- **`sleepAfter`**: Duration string (e.g., "5m", "30m", "2h"). Container stops after this period of inactivity. Timer resets on each request.
|
|
135
|
-
|
|
136
|
-
- **`enableInternet`**: Boolean. If `true`, container can make outbound HTTP/TCP requests.
|
|
137
|
-
|
|
138
|
-
- **`pingEndpoint`**: Path used for health checks. Should respond with 2xx status.
|
|
139
|
-
|
|
140
|
-
- **`envVars`**: Object of environment variables. Merged with runtime-provided vars (see below).
|
|
141
|
-
|
|
142
|
-
- **`entrypoint`**: Array of strings. Overrides container image's CMD/ENTRYPOINT.
|
|
143
|
-
|
|
144
|
-
### Runtime Environment Variables
|
|
145
|
-
|
|
146
|
-
Cloudflare automatically provides these environment variables to containers:
|
|
147
|
-
|
|
148
|
-
| Variable | Description |
|
|
149
|
-
|----------|-------------|
|
|
150
|
-
| `CLOUDFLARE_APPLICATION_ID` | Worker application ID |
|
|
151
|
-
| `CLOUDFLARE_COUNTRY_A2` | Two-letter country code of request origin |
|
|
152
|
-
| `CLOUDFLARE_LOCATION` | Cloudflare data center location |
|
|
153
|
-
| `CLOUDFLARE_REGION` | Region identifier |
|
|
154
|
-
| `CLOUDFLARE_DURABLE_OBJECT_ID` | Container's Durable Object ID |
|
|
155
|
-
|
|
156
|
-
Custom `envVars` from Container class are merged with these. Custom vars override runtime vars if names conflict.
|
|
157
|
-
|
|
158
|
-
### Image Management
|
|
159
|
-
|
|
160
|
-
**Distribution model:** Images pre-fetched to all global locations before deployment. Ensures fast cold starts (2-3s typical).
|
|
161
|
-
|
|
162
|
-
**Rolling deploys:** Unlike Workers (instant), container deployments roll out gradually. Old versions continue running during rollout.
|
|
163
|
-
|
|
164
|
-
**Ephemeral disk:** Container disk is ephemeral and resets on each stop. Use Durable Object storage (`this.ctx.storage`) for persistence.
|
|
165
|
-
|
|
166
|
-
## wrangler.toml Format
|
|
167
|
-
|
|
168
|
-
```toml
|
|
169
|
-
name = "my-worker"
|
|
170
|
-
main = "src/index.ts"
|
|
171
|
-
compatibility_date = "2026-01-10"
|
|
172
|
-
|
|
173
|
-
[[containers]]
|
|
174
|
-
class_name = "MyContainer"
|
|
175
|
-
image = "./Dockerfile"
|
|
176
|
-
instance_type = "standard-2"
|
|
177
|
-
max_instances = 10
|
|
178
|
-
|
|
179
|
-
[[durable_objects.bindings]]
|
|
180
|
-
name = "MY_CONTAINER"
|
|
181
|
-
class_name = "MyContainer"
|
|
182
|
-
|
|
183
|
-
[[migrations]]
|
|
184
|
-
tag = "v1"
|
|
185
|
-
new_sqlite_classes = ["MyContainer"]
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
Both `wrangler.jsonc` and `wrangler.toml` are supported. Use `wrangler.jsonc` for comments and better IDE support.
|
|
1
|
+
# Containers configuration
|
|
2
|
+
|
|
3
|
+
Read the relevant documentation before choosing configuration fields or resource sizes.
|
|
4
|
+
|
|
5
|
+
| Task | Documentation |
|
|
6
|
+
| --- | --- |
|
|
7
|
+
| Configure the container image, Durable Object binding, class, migrations, and instance count | [Wrangler Containers configuration](https://developers.cloudflare.com/workers/wrangler/configuration/#containers) |
|
|
8
|
+
| Select a predefined size or configure custom CPU, memory, and disk | [Limits and instance types](https://developers.cloudflare.com/containers/platform/limits/) and [custom instance configuration](https://developers.cloudflare.com/workers/wrangler/configuration/#custom-instance-types) |
|
|
9
|
+
| Set ports, readiness checks, idle timeout, entrypoint, or internet access | [Container properties](https://developers.cloudflare.com/containers/reference/container-class/#properties) |
|
|
10
|
+
| Set runtime variables or pass secrets per instance | [Environment variables](https://developers.cloudflare.com/containers/configuration/environment-variables/) and [environment variables and secrets example](https://developers.cloudflare.com/containers/examples/env-vars-and-secrets/) |
|
|
11
|
+
| Build images or use existing registry images | [Image management](https://developers.cloudflare.com/containers/guides/image-management/) |
|
|
12
|
+
| Run and iterate locally | [Local development](https://developers.cloudflare.com/containers/guides/local-dev/) |
|
|
13
|
+
| Deploy from a workstation or Workers Builds | [Deploy Containers](https://developers.cloudflare.com/containers/guides/deploy/) |
|
|
14
|
+
| Control image updates and replacement of running instances | [Rollouts](https://developers.cloudflare.com/containers/configuration/rollouts/) |
|
|
15
|
+
| Estimate resource and network costs | [Pricing](https://developers.cloudflare.com/containers/platform/pricing/) |
|
|
@@ -1,178 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
### ⚠️ startAndWaitForPorts() vs start()
|
|
20
|
-
|
|
21
|
-
**Problem:** "connection refused" after `start()`
|
|
22
|
-
|
|
23
|
-
**Cause:** `start()` returns when process starts, NOT when ports ready
|
|
24
|
-
|
|
25
|
-
**Fix:** Use `startAndWaitForPorts()` before requests
|
|
26
|
-
|
|
27
|
-
```typescript
|
|
28
|
-
// ❌ WRONG
|
|
29
|
-
await container.start();
|
|
30
|
-
return container.fetch(request);
|
|
31
|
-
|
|
32
|
-
// ✅ CORRECT
|
|
33
|
-
await container.startAndWaitForPorts();
|
|
34
|
-
return container.fetch(request);
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
### ⚠️ Activity Timeout on Long Operations
|
|
38
|
-
|
|
39
|
-
**Problem:** Container stops during long work
|
|
40
|
-
|
|
41
|
-
**Cause:** `sleepAfter` based on request activity, not internal work
|
|
42
|
-
|
|
43
|
-
**Fix:** Renew timeout by touching storage
|
|
44
|
-
|
|
45
|
-
```typescript
|
|
46
|
-
const interval = setInterval(() => {
|
|
47
|
-
this.ctx.storage.put("keepalive", Date.now());
|
|
48
|
-
}, 60000);
|
|
49
|
-
|
|
50
|
-
try {
|
|
51
|
-
await this.doLongWork(data);
|
|
52
|
-
} finally {
|
|
53
|
-
clearInterval(interval);
|
|
54
|
-
}
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
### ⚠️ blockConcurrencyWhile for Startup
|
|
58
|
-
|
|
59
|
-
**Problem:** Race conditions during initialization
|
|
60
|
-
|
|
61
|
-
**Fix:** Use `blockConcurrencyWhile` for atomic initialization
|
|
62
|
-
|
|
63
|
-
```typescript
|
|
64
|
-
await this.ctx.blockConcurrencyWhile(async () => {
|
|
65
|
-
if (!this.initialized) {
|
|
66
|
-
await this.startAndWaitForPorts();
|
|
67
|
-
this.initialized = true;
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
### ⚠️ Lifecycle Hooks Block Requests
|
|
73
|
-
|
|
74
|
-
**Problem:** Container unresponsive during `onStart()`
|
|
75
|
-
|
|
76
|
-
**Cause:** Hooks run in `blockConcurrencyWhile` - no concurrent requests
|
|
77
|
-
|
|
78
|
-
**Fix:** Keep hooks fast, avoid long operations
|
|
79
|
-
|
|
80
|
-
### ⚠️ Don't Override alarm() When Using schedule()
|
|
81
|
-
|
|
82
|
-
**Problem:** Scheduled tasks don't execute
|
|
83
|
-
|
|
84
|
-
**Cause:** `schedule()` uses `alarm()` internally
|
|
85
|
-
|
|
86
|
-
**Fix:** Implement `alarm()` to handle scheduled tasks
|
|
87
|
-
|
|
88
|
-
## Common Errors
|
|
89
|
-
|
|
90
|
-
### "Container start timeout"
|
|
91
|
-
|
|
92
|
-
**Cause:** Container took >8s (`start()`) or >20s (`startAndWaitForPorts()`)
|
|
93
|
-
|
|
94
|
-
**Solutions:**
|
|
95
|
-
- Optimize image (smaller base, fewer layers)
|
|
96
|
-
- Check `entrypoint` correct
|
|
97
|
-
- Verify app listens on correct ports
|
|
98
|
-
- Increase timeout if needed
|
|
99
|
-
|
|
100
|
-
### "Port not available"
|
|
101
|
-
|
|
102
|
-
**Cause:** Calling `fetch()` before port ready
|
|
103
|
-
|
|
104
|
-
**Solution:** Use `startAndWaitForPorts()`
|
|
105
|
-
|
|
106
|
-
### "Container memory exceeded"
|
|
107
|
-
|
|
108
|
-
**Cause:** Using more memory than instance type allows
|
|
109
|
-
|
|
110
|
-
**Solutions:**
|
|
111
|
-
- Use larger instance type (standard-2, standard-3, standard-4)
|
|
112
|
-
- Optimize app memory usage
|
|
113
|
-
- Use custom instance type
|
|
114
|
-
|
|
115
|
-
```jsonc
|
|
116
|
-
"instance_type_custom": {
|
|
117
|
-
"vcpu": 2,
|
|
118
|
-
"memory_mib": 8192
|
|
119
|
-
}
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
### "Max instances reached"
|
|
123
|
-
|
|
124
|
-
**Cause:** All `max_instances` slots in use
|
|
125
|
-
|
|
126
|
-
**Solutions:**
|
|
127
|
-
- Increase `max_instances`
|
|
128
|
-
- Implement proper `sleepAfter`
|
|
129
|
-
- Use `getRandom()` for distribution
|
|
130
|
-
- Check for instance leaks
|
|
131
|
-
|
|
132
|
-
### "No container instance available"
|
|
133
|
-
|
|
134
|
-
**Cause:** Account capacity limits reached
|
|
135
|
-
|
|
136
|
-
**Solutions:**
|
|
137
|
-
- Check account limits
|
|
138
|
-
- Review instance types across containers
|
|
139
|
-
- Contact Cloudflare support
|
|
140
|
-
|
|
141
|
-
## Limits
|
|
142
|
-
|
|
143
|
-
| Resource | Limit | Notes |
|
|
144
|
-
|----------|-------|-------|
|
|
145
|
-
| Cold start | 2-3s | Image pre-fetched globally |
|
|
146
|
-
| Graceful shutdown | 15 min | SIGTERM → SIGKILL |
|
|
147
|
-
| `start()` timeout | 8s | Process start |
|
|
148
|
-
| `startAndWaitForPorts()` timeout | 20s | Port ready |
|
|
149
|
-
| Max vCPU per container | 4 | standard-4 or custom |
|
|
150
|
-
| Max memory per container | 12 GiB | standard-4 or custom |
|
|
151
|
-
| Max disk per container | 20 GB | Ephemeral, resets |
|
|
152
|
-
| Account total memory | 400 GiB | All containers |
|
|
153
|
-
| Account total vCPU | 100 | All containers |
|
|
154
|
-
| Account total disk | 2 TB | All containers |
|
|
155
|
-
| Image storage | 50 GB | Per account |
|
|
156
|
-
| Disk persistence | None | Use DO storage |
|
|
157
|
-
|
|
158
|
-
## Best Practices
|
|
159
|
-
|
|
160
|
-
1. **Use `startAndWaitForPorts()` by default** - Prevents port errors
|
|
161
|
-
2. **Set appropriate `sleepAfter`** - Balance resources vs cold starts
|
|
162
|
-
3. **Use `fetch()` for WebSocket** - Not `containerFetch()`
|
|
163
|
-
4. **Design for restarts** - Ephemeral disk, implement graceful shutdown
|
|
164
|
-
5. **Monitor resources** - Stay within account limits
|
|
165
|
-
6. **Keep hooks fast** - Run in `blockConcurrencyWhile`
|
|
166
|
-
7. **Renew activity for long ops** - Touch storage to prevent timeout
|
|
167
|
-
|
|
168
|
-
## Beta Caveats
|
|
169
|
-
|
|
170
|
-
⚠️ Containers in **beta**:
|
|
171
|
-
|
|
172
|
-
- **API may change** without notice
|
|
173
|
-
- **No SLA** guarantees
|
|
174
|
-
- **Limited regions** initially
|
|
175
|
-
- **No autoscaling** - manual via `getRandom()`
|
|
176
|
-
- **Rolling deploys** only (not instant like Workers)
|
|
177
|
-
|
|
178
|
-
Plan for API changes, test thoroughly before production.
|
|
1
|
+
# Containers troubleshooting
|
|
2
|
+
|
|
3
|
+
Use the current documentation to diagnose behavior instead of relying on copied timeout values, resource limits, or lifecycle recipes.
|
|
4
|
+
|
|
5
|
+
| Symptom or concern | Documentation to read |
|
|
6
|
+
| --- | --- |
|
|
7
|
+
| Startup timeout or unavailable port | [Start and stop](https://developers.cloudflare.com/containers/reference/container-class/#start-and-stop), [Container properties](https://developers.cloudflare.com/containers/reference/container-class/#properties), and [first-deploy provisioning](https://developers.cloudflare.com/containers/get-started/) |
|
|
8
|
+
| WebSocket forwarding fails | [WebSocket example](https://developers.cloudflare.com/containers/examples/websocket/) and [request methods](https://developers.cloudflare.com/containers/reference/container-class/#request-methods) |
|
|
9
|
+
| Background work stops on idle expiry | [Activity renewal](https://developers.cloudflare.com/containers/reference/container-class/#renewactivitytimeout) and [idle expiry hook](https://developers.cloudflare.com/containers/reference/container-class/#onactivityexpired) |
|
|
10
|
+
| Scheduled callbacks do not run | [Scheduling and alarm ownership](https://developers.cloudflare.com/containers/reference/container-class/#scheduling) |
|
|
11
|
+
| Shutdown cleanup or filesystem data loss | [Container shutdown and disk lifecycle](https://developers.cloudflare.com/containers/concepts/architecture/#container-shutdown) |
|
|
12
|
+
| Out-of-memory errors or resource exhaustion | [FAQ](https://developers.cloudflare.com/containers/faq/) and [limits and instance types](https://developers.cloudflare.com/containers/platform/limits/) |
|
|
13
|
+
| Instance count exceeded or unexpected request distribution | [Wrangler configuration](https://developers.cloudflare.com/workers/wrangler/configuration/#containers) and [scaling and routing](https://developers.cloudflare.com/containers/configuration/scaling-and-routing/) |
|
|
14
|
+
| Worker and container image versions differ after deployment | [Deployment behavior](https://developers.cloudflare.com/containers/guides/deploy/) and [rollouts](https://developers.cloudflare.com/containers/configuration/rollouts/) |
|
|
15
|
+
| Local behavior differs from deployed behavior | [Local development](https://developers.cloudflare.com/containers/guides/local-dev/) |
|
|
16
|
+
| Logs, cold starts, or runtime availability questions | [FAQ](https://developers.cloudflare.com/containers/faq/) |
|