Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Comprehensive Cloudflare platform skill covering Workers, D1, R2, KV, AI, Durable Objects, and security.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/workers-for-platforms/gotchas.md
1# Gotchas & Limits23## Common Errors45### "Worker not found"67**Cause:** Attempting to get Worker that doesn't exist in namespace8**Solution:** Catch error and return 404:910```typescript11try {12const userWorker = env.DISPATCHER.get(workerName);13return userWorker.fetch(request);14} catch (e) {15if (e.message.startsWith("Worker not found")) {16return new Response("Worker not found", { status: 404 });17}18throw e; // Re-throw unexpected errors19}20```2122### "CPU time limit exceeded"2324**Cause:** User Worker exceeded configured CPU time limit25**Solution:** Track violations in Analytics Engine and return 429 response; consider adjusting limits per customer tier2627### "Hostname Routing Issues"2829**Cause:** DNS proxy settings causing routing problems30**Solution:** Use `*/*` wildcard route which works regardless of proxy settings for orange-to-orange routing3132### "Bindings Lost on Update"3334**Cause:** Not using `keep_bindings` flag when updating Worker35**Solution:** Use `keep_bindings: true` in API requests to preserve existing bindings during updates3637### "Tag Filtering Not Working"3839**Cause:** Special characters not URL encoded in tag filters40**Solution:** URL encode tags (e.g., `tags=production%3Ayes`) and avoid special chars like `,` and `&`4142### "Deploy Failures with ES Modules"4344**Cause:** Incorrect upload format for ES modules45**Solution:** Use multipart form upload, specify `main_module` in metadata, and set file type to `application/javascript+module`4647### "Static Asset Upload Failed"4849**Cause:** Invalid hash format, expired token, or incorrect encoding50**Solution:** Hash must be first 16 bytes (32 hex chars) of SHA-256, upload within 1 hour of session creation, deploy within 1 hour of upload completion, and Base64 encode file contents5152### "Outbound Worker Not Intercepting Calls"5354**Cause:** Outbound Workers don't intercept Durable Object or mTLS binding fetch55**Solution:** Plan egress control accordingly; not all fetch calls are intercepted5657### "TCP Socket Connection Failed"5859**Cause:** Outbound Worker enabled blocks `connect()` API for TCP sockets60**Solution:** Outbound Workers only intercept `fetch()` calls; TCP socket connections unavailable when outbound configured. Remove outbound if TCP needed, or use proxy pattern.6162### "API Rate Limit Exceeded"6364**Cause:** Exceeded Cloudflare API rate limits (1200 requests per 5 minutes per account, 200 requests per second per IP)65**Solution:** Implement exponential backoff:6667```typescript68async function deployWithBackoff(deploy: () => Promise<void>, maxRetries = 3) {69for (let i = 0; i < maxRetries; i++) {70try {71return await deploy();72} catch (e) {73if (e.status === 429 && i < maxRetries - 1) {74await new Promise(r => setTimeout(r, Math.pow(2, i) * 1000));75continue;76}77throw e;78}79}80}81```8283### "Gradual Deployment Not Supported"8485**Cause:** Attempted to use gradual deployments with user Workers86**Solution:** Gradual deployments not supported for Workers in dispatch namespaces. Use all-at-once deployment with staged rollout via dispatch worker logic (feature flags, percentage-based routing).8788### "Asset Session Expired"8990**Cause:** Upload JWT expired (1 hour validity) or completion token expired (1 hour after upload)91**Solution:** Complete asset upload within 1 hour of session creation, and deploy Worker within 1 hour of upload completion. For large uploads, batch files or increase upload parallelism.9293## Platform Limits9495| Limit | Value | Notes |96|-------|-------|-------|97| Workers per namespace | Unlimited | Unlike regular Workers (500 per account) |98| Namespaces per account | Unlimited | Best practice: 1 production + 1 staging |99| Max tags per Worker | 8 | For filtering and organization |100| Worker mode | Untrusted (default) | No `request.cf` access unless trusted mode |101| Cache isolation | Per-Worker (untrusted) | Shared in trusted mode with key prefixes |102| Durable Object namespaces | Unlimited | No per-account limit for WfP |103| Gradual Deployments | Not supported | All-at-once only |104| `caches.default` | Disabled (untrusted) | Use Cache API with custom keys |105106## Asset Upload Limits107108| Limit | Value | Notes |109|-------|-------|-------|110| Upload session JWT validity | 1 hour | Must complete upload within this time |111| Completion token validity | 1 hour | Must deploy within this time after upload |112| Asset hash format | First 16 bytes SHA-256 | 32 hex characters |113| Base64 encoding | Required | For binary files |114115## API Rate Limits116117| Limit Type | Value | Scope |118|------------|-------|-------|119| Client API | 1200 requests / 5 min | Per account |120| Client API | 200 requests / sec | Per IP address |121| GraphQL | Varies by query cost | Query complexity |122123See [Cloudflare API Rate Limits](https://developers.cloudflare.com/fundamentals/api/reference/limits/) for details.124125## Operational Limits126127| Operation | Limit | Notes |128|-----------|-------|-------|129| CPU time (custom limits) | Up to Workers plan limit | Set per-invocation in dispatch worker |130| Subrequests (custom limits) | Up to Workers plan limit | Set per-invocation in dispatch worker |131| Outbound Worker subrequests | Not intercepted for DO/mTLS | Only regular fetch() calls |132| TCP sockets with outbound | Disabled | `connect()` API unavailable |133134See [README.md](./README.md), [configuration.md](./configuration.md), [api.md](./api.md), [patterns.md](./patterns.md)135