vybekiit 0.7.3 → 0.7.7
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/dist/bin.js +16607 -7527
- package/dist/global-skills/aws-cdk/SKILL.md +2 -1
- package/dist/global-skills/aws-cloudformation/SKILL.md +2 -1
- package/dist/global-skills/aws-serverless/SKILL.md +45 -44
- package/dist/global-skills/aws-serverless/assets/powertools-handler.py +2 -1
- package/dist/global-skills/aws-serverless/references/api-gateway.md +50 -470
- package/dist/global-skills/aws-serverless/references/architecture.md +47 -186
- package/dist/global-skills/aws-serverless/references/concurrency.md +44 -158
- package/dist/global-skills/aws-serverless/references/deployment.md +1 -1
- package/dist/global-skills/aws-serverless/references/event-sources.md +72 -391
- package/dist/global-skills/aws-serverless/references/lambda.md +69 -428
- package/dist/global-skills/aws-serverless/references/orchestration.md +65 -384
- package/dist/global-skills/aws-serverless/references/production.md +78 -415
- package/dist/global-skills/aws-serverless/references/troubleshooting.md +92 -619
- package/dist/global-skills/claimable-postgres/SKILL.md +60 -49
- package/dist/global-skills/design-my-data/SKILL.md +2 -0
- package/dist/global-skills/eas-app-stores/SKILL.md +8 -0
- package/dist/global-skills/eas-app-stores/references/play-store.md +2 -0
- package/dist/global-skills/eas-hosting/SKILL.md +8 -0
- package/dist/global-skills/eas-observe/SKILL.md +30 -8
- package/dist/global-skills/eas-observe/agents/openai.yaml +1 -1
- package/dist/global-skills/eas-observe/references/metrics.md +54 -3
- package/dist/global-skills/eas-observe/references/queries.md +78 -17
- package/dist/global-skills/eas-observe/references/setup.md +164 -5
- package/dist/global-skills/eas-observe/references/third-party.md +136 -0
- package/dist/global-skills/eas-simulator/SKILL.md +63 -11
- package/dist/global-skills/eas-simulator/references/controllers.md +21 -2
- package/dist/global-skills/eas-simulator/references/run-your-app.md +16 -11
- package/dist/global-skills/eas-simulator/references/troubleshooting.md +8 -5
- package/dist/global-skills/eas-update-insights/SKILL.md +8 -0
- package/dist/global-skills/eas-workflows/SKILL.md +15 -10
- package/dist/global-skills/eas-workflows/scripts/package.json +2 -7
- package/dist/global-skills/email-best-practices/.github/workflows/sync-skills.yml +30 -0
- package/dist/global-skills/email-best-practices/README.md +63 -0
- package/dist/global-skills/email-best-practices/references/accessibility.md +189 -0
- package/dist/global-skills/email-best-practices/references/compliance.md +125 -0
- package/dist/global-skills/email-best-practices/references/deliverability.md +121 -0
- package/dist/global-skills/email-best-practices/references/email-capture.md +129 -0
- package/dist/global-skills/email-best-practices/references/email-types.md +173 -0
- package/dist/global-skills/email-best-practices/references/list-management.md +157 -0
- package/dist/global-skills/email-best-practices/references/marketing-emails.md +115 -0
- package/dist/global-skills/email-best-practices/references/sending-reliability.md +155 -0
- package/dist/global-skills/email-best-practices/references/transactional-email-catalog.md +418 -0
- package/dist/global-skills/email-best-practices/references/transactional-emails.md +92 -0
- package/dist/global-skills/email-best-practices/references/webhooks-events.md +167 -0
- package/dist/global-skills/email-best-practices/tests/README.md +35 -0
- package/dist/global-skills/email-best-practices/tests/scenarios/01-spam-deliverability.md +46 -0
- package/dist/global-skills/email-best-practices/tests/scenarios/02-multi-region-compliance.md +48 -0
- package/dist/global-skills/email-best-practices/tests/scenarios/03-retry-idempotency.md +36 -0
- package/dist/global-skills/email-best-practices/tests/scenarios/04-webhook-bounce-handling.md +52 -0
- package/dist/global-skills/email-best-practices/tests/scenarios/05-new-saas-email-plan.md +51 -0
- package/dist/global-skills/expo-animation/LICENSE +21 -0
- package/dist/global-skills/expo-animation/RECIPES.md +385 -0
- package/dist/global-skills/expo-animation/SKILL.md +267 -0
- package/dist/global-skills/expo-animation/agents/openai.yaml +4 -0
- package/dist/global-skills/expo-app-clip/SKILL.md +8 -0
- package/dist/global-skills/expo-brownfield/SKILL.md +8 -0
- package/dist/global-skills/expo-brownfield/references/brownfield-isolated.md +53 -4
- package/dist/global-skills/expo-data-fetching/SKILL.md +8 -0
- package/dist/global-skills/expo-design-system/SKILL.md +356 -0
- package/dist/global-skills/expo-design-system/agents/openai.yaml +4 -0
- package/dist/global-skills/expo-design-system/references/audit.md +185 -0
- package/dist/global-skills/expo-dev-client/SKILL.md +8 -0
- package/dist/global-skills/expo-dom/SKILL.md +8 -0
- package/dist/global-skills/expo-examples/SKILL.md +8 -0
- package/dist/global-skills/expo-migrate-module/SKILL.md +113 -0
- package/dist/global-skills/expo-migrate-module/agents/openai.yaml +4 -0
- package/dist/global-skills/expo-migrate-module/references/compatibility.md +73 -0
- package/dist/global-skills/expo-migrate-module/references/example.md +212 -0
- package/dist/global-skills/expo-migrate-module/references/migration-map.md +306 -0
- package/dist/global-skills/expo-module/SKILL.md +11 -1
- package/dist/global-skills/expo-native-ui/SKILL.md +8 -0
- package/dist/global-skills/expo-project-structure/SKILL.md +114 -0
- package/dist/global-skills/expo-project-structure/agents/openai.yaml +4 -0
- package/dist/global-skills/expo-router/SKILL.md +8 -0
- package/dist/global-skills/expo-skill-feedback/SKILL.md +66 -33
- package/dist/global-skills/expo-skill-feedback/agents/openai.yaml +2 -2
- package/dist/global-skills/expo-tailwind-setup/SKILL.md +8 -0
- package/dist/global-skills/expo-ui/SKILL.md +8 -0
- package/dist/global-skills/expo-upgrade/SKILL.md +15 -1
- package/dist/global-skills/expo-web-to-native/SKILL.md +8 -0
- package/dist/global-skills/extension-to-functions-codebase/SKILL.md +129 -0
- package/dist/global-skills/extension-to-functions-codebase/references/configuration-migration.md +161 -0
- package/dist/global-skills/extension-to-functions-codebase/references/destructuring-shim.md +122 -0
- package/dist/global-skills/extension-to-functions-codebase/references/signature-mapping.md +84 -0
- package/dist/global-skills/firebase-ai-logic-basics/SKILL.md +61 -19
- package/dist/global-skills/firebase-ai-logic-basics/references/flutter_setup.md +6 -3
- package/dist/global-skills/firebase-app-hosting-basics/SKILL.md +5 -1
- package/dist/global-skills/firebase-auth-basics/SKILL.md +4 -2
- package/dist/global-skills/firebase-basics/SKILL.md +5 -5
- package/dist/global-skills/firebase-crashlytics/SKILL.md +2 -0
- package/dist/global-skills/firebase-data-connect/SKILL.md +2 -0
- package/dist/global-skills/firebase-firestore/SKILL.md +3 -6
- package/dist/global-skills/firebase-hosting-basics/SKILL.md +4 -1
- package/dist/global-skills/firebase-remote-config-basics/SKILL.md +5 -1
- package/dist/global-skills/firebase-security-rules-auditor/SKILL.md +4 -1
- package/dist/global-skills/harden/SKILL.md +2 -1
- package/dist/global-skills/instrument-feature-flags/SKILL.md +1 -0
- package/dist/global-skills/instrument-feature-flags/references/COMMANDMENTS.md +5 -0
- package/dist/global-skills/instrument-feature-flags/references/adding-feature-flag-code.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/android.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/api.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/best-practices.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/django.md +38 -5
- package/dist/global-skills/instrument-feature-flags/references/dotnet.md +10 -4
- package/dist/global-skills/instrument-feature-flags/references/elixir.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/flask.md +17 -5
- package/dist/global-skills/instrument-feature-flags/references/flutter.md +7 -5
- package/dist/global-skills/instrument-feature-flags/references/go.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/ios.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/java.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/laravel.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/next-js.md +74 -8
- package/dist/global-skills/instrument-feature-flags/references/nodejs.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/php.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/python.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/react-native.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/react.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/ruby-on-rails.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/ruby.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/rust.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/usage.md +41 -4
- package/dist/global-skills/instrument-feature-flags/references/web.md +7 -5
- package/dist/global-skills/instrument-product-analytics/SKILL.md +2 -1
- package/dist/global-skills/instrument-product-analytics/references/COMMANDMENTS.md +5 -0
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-astro-hybrid.md +12 -14
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-astro-ssr.md +25 -21
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-django.md +75 -55
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-fastapi.md +3 -6
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-flask.md +26 -16
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-nuxt-3-6.md +8 -5
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-nuxt-4.md +4 -4
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-react-react-router-7-framework.md +3 -3
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-ruby-on-rails.md +8 -4
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-tanstack-start.md +20 -8
- package/dist/global-skills/instrument-product-analytics/references/android.md +46 -4
- package/dist/global-skills/instrument-product-analytics/references/angular.md +41 -5
- package/dist/global-skills/instrument-product-analytics/references/astro.md +41 -5
- package/dist/global-skills/instrument-product-analytics/references/configuration.md +7 -4
- package/dist/global-skills/instrument-product-analytics/references/django.md +38 -5
- package/dist/global-skills/instrument-product-analytics/references/dotnet.md +10 -4
- package/dist/global-skills/instrument-product-analytics/references/elixir.md +6 -4
- package/dist/global-skills/instrument-product-analytics/references/flask.md +17 -5
- package/dist/global-skills/instrument-product-analytics/references/flutter.md +49 -4
- package/dist/global-skills/instrument-product-analytics/references/go.md +6 -4
- package/dist/global-skills/instrument-product-analytics/references/identify-users.md +38 -7
- package/dist/global-skills/instrument-product-analytics/references/ios.md +14 -4
- package/dist/global-skills/instrument-product-analytics/references/laravel.md +6 -4
- package/dist/global-skills/instrument-product-analytics/references/next-js.md +74 -8
- package/dist/global-skills/instrument-product-analytics/references/nuxt-js-3-6.md +39 -7
- package/dist/global-skills/instrument-product-analytics/references/nuxt-js.md +40 -4
- package/dist/global-skills/instrument-product-analytics/references/php.md +6 -4
- package/dist/global-skills/instrument-product-analytics/references/posthog-python.md +21 -17
- package/dist/global-skills/instrument-product-analytics/references/python.md +15 -5
- package/dist/global-skills/instrument-product-analytics/references/react-native.md +41 -7
- package/dist/global-skills/instrument-product-analytics/references/react-router-v6.md +18 -4
- package/dist/global-skills/instrument-product-analytics/references/react-router-v7-data-mode.md +18 -4
- package/dist/global-skills/instrument-product-analytics/references/react-router-v7-declarative-mode.md +18 -4
- package/dist/global-skills/instrument-product-analytics/references/react-router-v7-framework-mode.md +18 -4
- package/dist/global-skills/instrument-product-analytics/references/ruby-on-rails.md +6 -4
- package/dist/global-skills/instrument-product-analytics/references/ruby.md +6 -4
- package/dist/global-skills/instrument-product-analytics/references/svelte.md +42 -6
- package/dist/global-skills/instrument-product-analytics/references/tanstack-start.md +31 -7
- package/dist/global-skills/instrument-product-analytics/references/usage.md +41 -4
- package/dist/global-skills/instrument-product-analytics/references/vue-js.md +42 -6
- package/dist/global-skills/manifest.json +6 -1
- package/dist/global-skills/neon/SKILL.md +235 -121
- package/dist/global-skills/neon-ai-gateway/SKILL.md +95 -16
- package/dist/global-skills/neon-functions/SKILL.md +242 -152
- package/dist/global-skills/neon-functions/references/ai-sdk.md +9 -3
- package/dist/global-skills/neon-functions/references/mastra-studio.md +1 -1
- package/dist/global-skills/neon-functions/references/mcp.md +13 -4
- package/dist/global-skills/neon-functions/references/sentry.md +165 -52
- package/dist/global-skills/neon-functions/references/sse.md +23 -6
- package/dist/global-skills/neon-object-storage/SKILL.md +40 -16
- package/dist/global-skills/neon-postgres/SKILL.md +63 -262
- package/dist/global-skills/neon-postgres-branches/SKILL.md +61 -50
- package/dist/global-skills/neon-postgres-egress-optimizer/SKILL.md +22 -3
- package/dist/global-skills/resend/SKILL.md +6 -6
- package/dist/global-skills/resend/references/automations.md +2 -2
- package/dist/global-skills/resend/references/broadcasts.md +11 -3
- package/dist/global-skills/resend/references/domains.md +25 -3
- package/dist/global-skills/resend/references/installation.md +7 -7
- package/dist/global-skills/setup-payments/SKILL.md +4 -5
- package/dist/global-skills/stripe-best-practices/SKILL.md +32 -7
- package/dist/global-skills/stripe-best-practices/references/billing.md +11 -1
- package/dist/global-skills/stripe-best-practices/references/payments.md +23 -2
- package/dist/global-skills/stripe-best-practices/references/security.md +21 -11
- package/dist/global-skills/stripe-best-practices/references/tax.md +116 -11
- package/dist/global-skills/supabase/CHANGELOG.md +25 -0
- package/dist/global-skills/supabase/SKILL.md +5 -1
- package/dist/global-skills/supabase-postgres-best-practices/CHANGELOG.md +30 -0
- package/dist/global-skills/supabase-postgres-best-practices/SKILL.md +1 -1
- package/dist/global-skills/use-kit-mcp/SKILL.md +5 -5
- package/dist/global-skills/use-railway/SKILL.md +4 -4
- package/dist/global-skills/use-railway/references/iac.md +206 -57
- package/dist/global-skills/use-railway/scripts/railway-api.sh +7 -2
- package/dist/global-skills/xcode-project-setup/SKILL.md +2 -0
- package/package.json +12 -9
- package/LICENSE.md +0 -47
- package/dist/global-skills/eas-workflows/scripts/validate.js +0 -84
- package/dist/global-skills/expo-skill-feedback/scripts/skill-feedback.cjs +0 -118
- package/dist/global-skills/neon-functions/references/hono-websockets.md +0 -145
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
# API Gateway Reference
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Exact quotas and the handful of gotchas worth pinning down. Assumes you know the basics: choose **REST API** when you need WAF / API keys / usage plans / request validation / built-in caching / edge-optimized / canary / VTL / resource policies, otherwise **HTTP API** (lower latency, native JWT, built-in CORS, auto-deploy); under Lambda **proxy** integration the **Lambda must return CORS headers** (the console "Enable CORS" button doesn't apply); the **#1 cause of 502** is a malformed proxy response (`body` must be a `JSON.stringify`'d string in the `{statusCode, headers, body}` shape); REST API has **no native generic JWT** (use Cognito or a Lambda authorizer), HTTP API has a **native JWT authorizer** for any OIDC IdP.
|
|
4
4
|
|
|
5
5
|
## Contents
|
|
6
6
|
|
|
7
|
-
- [REST vs HTTP API
|
|
8
|
-
- [
|
|
9
|
-
- [
|
|
10
|
-
- [
|
|
7
|
+
- [REST vs HTTP API comparison](#rest-vs-http-api-comparison)
|
|
8
|
+
- [Integration timeouts and payloads](#integration-timeouts-and-payloads)
|
|
9
|
+
- [Throttling and quotas](#throttling-and-quotas)
|
|
10
|
+
- [Lambda authorizers](#lambda-authorizers)
|
|
11
11
|
- [WebSocket APIs](#websocket-apis)
|
|
12
|
-
- [
|
|
12
|
+
- [CORS gotchas](#cors-gotchas)
|
|
13
13
|
|
|
14
14
|
---
|
|
15
15
|
|
|
16
|
-
## REST vs HTTP API
|
|
16
|
+
## REST vs HTTP API comparison
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
Default to **HTTP API** (lower latency, lower cost, simpler); reach for **REST API** only when you need one of its exclusive features:
|
|
19
19
|
|
|
20
20
|
```
|
|
21
21
|
Need any of these? → REST API
|
|
@@ -34,520 +34,100 @@ Need any of these? → REST API
|
|
|
34
34
|
None of the above? → HTTP API (lower latency, simpler)
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
### Feature Comparison
|
|
38
|
-
|
|
39
|
-
| Feature | REST API | HTTP API |
|
|
40
|
-
|---|---|---|
|
|
41
|
-
| **Latency** | Higher | Lower |
|
|
42
|
-
| **Endpoint types** | Edge, Regional, Private | Regional only |
|
|
43
|
-
| **AWS WAF** | Yes | No |
|
|
44
|
-
| **API keys / usage plans** | Yes | No |
|
|
45
|
-
| **Per-client throttling** | Yes | No |
|
|
46
|
-
| **Request validation** | Yes | No |
|
|
47
|
-
| **Body transformation (VTL)** | Yes | No |
|
|
48
|
-
| **Parameter mapping** | Yes | Yes |
|
|
49
|
-
| **Caching (built-in)** | Yes | No |
|
|
50
|
-
| **Custom domains** | Yes | Yes |
|
|
51
|
-
| **Lambda authorizers** | Yes (TOKEN + REQUEST) | Yes (REQUEST only) |
|
|
52
|
-
| **JWT authorizers (native)** | No | Yes |
|
|
53
|
-
| **IAM auth** | Yes | Yes |
|
|
54
|
-
| **Cognito (native)** | Yes | Yes (via JWT) |
|
|
55
|
-
| **Resource policies** | Yes | No |
|
|
56
|
-
| **Mutual TLS** | Yes | Yes |
|
|
57
|
-
| **CORS setup** | Manual OPTIONS method | Built-in config |
|
|
58
|
-
| **Automatic deployments** | No | Yes |
|
|
59
|
-
| **Canary deployments** | Yes | No |
|
|
60
|
-
| **Custom gateway responses** | Yes | No |
|
|
61
|
-
| **Execution logs** | Yes | No |
|
|
62
|
-
| **Access logs (CloudWatch)** | Yes | Yes |
|
|
63
|
-
| **Access logs (Firehose)** | Yes | No |
|
|
64
|
-
| **X-Ray tracing** | Yes | No |
|
|
65
|
-
| **Mock integrations** | Yes | No |
|
|
66
|
-
| **Private integrations (NLB)** | Yes | Yes |
|
|
67
|
-
| **Private integrations (ALB)** | Yes | Yes |
|
|
68
|
-
| **Private integrations (Cloud Map)** | No | Yes |
|
|
69
|
-
| **Response streaming** | Yes | No |
|
|
70
|
-
| **Console test invocations** | Yes | No |
|
|
71
|
-
| **Integration timeout** | 50ms–29s (configurable) | 30s hard max |
|
|
72
|
-
| **Payload size** | 10 MB | 10 MB |
|
|
73
|
-
|
|
74
|
-
> **REST API streaming caveats:** Response streaming via REST API proxy integration does not support built-in caching, response transforms (VTL), or WAF inspection of streamed content. Idle timeouts apply, and a 2 MBps bandwidth cap applies after the first 10 MB (Function URLs apply the cap after 6 MB).
|
|
75
|
-
|
|
76
37
|
---
|
|
77
38
|
|
|
78
|
-
##
|
|
79
|
-
|
|
80
|
-
### Proxy vs Non-Proxy
|
|
39
|
+
## Integration timeouts and payloads
|
|
81
40
|
|
|
82
|
-
|
|
|
41
|
+
| | REST API | HTTP API |
|
|
83
42
|
|---|---|---|
|
|
84
|
-
|
|
|
85
|
-
|
|
|
86
|
-
|
|
|
87
|
-
|
|
88
|
-
### Debugging Flowchart
|
|
89
|
-
|
|
90
|
-
```
|
|
91
|
-
"Cross-Origin Request Blocked"?
|
|
92
|
-
│
|
|
93
|
-
├─ YES → Which integration type?
|
|
94
|
-
│ │
|
|
95
|
-
│ ├─ PROXY → Lambda MUST return CORS headers
|
|
96
|
-
│ │ ├─ Access-Control-Allow-Origin
|
|
97
|
-
│ │ ├─ Access-Control-Allow-Methods
|
|
98
|
-
│ │ └─ Access-Control-Allow-Headers
|
|
99
|
-
│ │
|
|
100
|
-
│ └─ NON-PROXY → Configure in API Gateway:
|
|
101
|
-
│ ├─ Create OPTIONS method (mock integration)
|
|
102
|
-
│ ├─ Add 200 response with CORS headers
|
|
103
|
-
│ └─ Add CORS headers to actual method responses
|
|
104
|
-
│
|
|
105
|
-
├─ OPTIONS returning 200?
|
|
106
|
-
│ ├─ NO → OPTIONS method missing or misconfigured
|
|
107
|
-
│ └─ YES → Check actual method response headers
|
|
108
|
-
│
|
|
109
|
-
└─ 502 on OPTIONS?
|
|
110
|
-
└─ Binary media types set to */* → fix below
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
### Common CORS Mistakes
|
|
114
|
-
|
|
115
|
-
| # | Mistake | Fix |
|
|
116
|
-
|---|---|---|
|
|
117
|
-
| 1 | No CORS headers in Lambda (proxy integration) | Add headers to every Lambda response |
|
|
118
|
-
| 2 | Missing OPTIONS method (REST API, non-proxy) | Create OPTIONS with mock integration |
|
|
119
|
-
| 3 | Binary media types `*/*` breaks OPTIONS | Set `contentHandling: CONVERT_TO_TEXT` on OPTIONS |
|
|
120
|
-
| 4 | `Allow-Origin: *` with `credentials: include` | Specify exact origin, not wildcard |
|
|
121
|
-
| 5 | Not redeploying API after CORS changes | Redeploy the stage |
|
|
122
|
-
| 6 | Missing `Allow-Headers` for custom headers | List all headers the client sends |
|
|
123
|
-
| 7 | Gateway 4XX/5XX responses lack CORS headers | Add CORS headers to gateway responses |
|
|
124
|
-
|
|
125
|
-
### Lambda CORS Headers — Python
|
|
126
|
-
|
|
127
|
-
```python
|
|
128
|
-
def handler(event, context):
|
|
129
|
-
return {
|
|
130
|
-
"statusCode": 200,
|
|
131
|
-
"headers": {
|
|
132
|
-
"Access-Control-Allow-Origin": "https://example.com",
|
|
133
|
-
"Access-Control-Allow-Methods": "OPTIONS,POST,GET,PUT,DELETE",
|
|
134
|
-
"Access-Control-Allow-Headers": "Content-Type,Authorization,X-Amz-Date,X-Api-Key,X-Amz-Security-Token",
|
|
135
|
-
},
|
|
136
|
-
"body": json.dumps({"message": "success"}),
|
|
137
|
-
}
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
### Lambda CORS Headers — TypeScript
|
|
141
|
-
|
|
142
|
-
```typescript
|
|
143
|
-
export const handler = async (event: any) => ({
|
|
144
|
-
statusCode: 200,
|
|
145
|
-
headers: {
|
|
146
|
-
"Access-Control-Allow-Origin": "https://example.com",
|
|
147
|
-
"Access-Control-Allow-Methods": "OPTIONS,POST,GET,PUT,DELETE",
|
|
148
|
-
"Access-Control-Allow-Headers": "Content-Type,Authorization,X-Amz-Date,X-Api-Key,X-Amz-Security-Token",
|
|
149
|
-
},
|
|
150
|
-
body: JSON.stringify({ message: "success" }),
|
|
151
|
-
});
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
### Binary Media Types `*/*` Fix
|
|
43
|
+
| Integration timeout | 50ms–29s (default 29s; **raisable only for Regional/private**) | **30s hard max** (lowerable, not raisable) |
|
|
44
|
+
| Payload size | 10 MB | 10 MB |
|
|
45
|
+
| Endpoint types | Edge, Regional, Private | Regional only |
|
|
46
|
+
| Response streaming | Yes (proxy, STREAM mode) | No |
|
|
155
47
|
|
|
156
|
-
|
|
157
|
-
# Fix OPTIONS integration request
|
|
158
|
-
aws apigateway update-integration \
|
|
159
|
-
--rest-api-id API_ID --resource-id RES_ID \
|
|
160
|
-
--http-method OPTIONS \
|
|
161
|
-
--patch-operations op='replace',path='/contentHandling',value='CONVERT_TO_TEXT'
|
|
162
|
-
|
|
163
|
-
# Fix OPTIONS integration response
|
|
164
|
-
aws apigateway update-integration-response \
|
|
165
|
-
--rest-api-id API_ID --resource-id RES_ID \
|
|
166
|
-
--http-method OPTIONS --status-code 200 \
|
|
167
|
-
--patch-operations op='replace',path='/contentHandling',value='CONVERT_TO_TEXT'
|
|
168
|
-
```
|
|
48
|
+
> **REST API streaming caveats:** no built-in caching, no VTL transforms, no WAF inspection of streamed content; 2 MBps cap after the first 10 MB (Function URLs cap after 6 MB).
|
|
169
49
|
|
|
170
50
|
---
|
|
171
51
|
|
|
172
|
-
##
|
|
173
|
-
|
|
174
|
-
### TOKEN vs REQUEST Authorizer
|
|
175
|
-
|
|
176
|
-
| Feature | TOKEN | REQUEST |
|
|
177
|
-
|---|---|---|
|
|
178
|
-
| Identity source | Single header (bearer token) | Headers, query strings, stage vars, `$context` |
|
|
179
|
-
| Cache key | Token header value | All specified identity sources |
|
|
180
|
-
| Token validation regex | Yes | No |
|
|
181
|
-
| Fine-grained policies | Limited | Yes (multiple sources) |
|
|
182
|
-
| Available on | REST API only | REST API + HTTP API |
|
|
183
|
-
| **Recommendation** | Legacy | **Preferred** |
|
|
184
|
-
|
|
185
|
-
> **Use REQUEST authorizers for new APIs.** TOKEN is legacy.
|
|
186
|
-
|
|
187
|
-
### Caching Behavior
|
|
188
|
-
|
|
189
|
-
| Setting | Detail |
|
|
190
|
-
|---|---|
|
|
191
|
-
| Default TTL | 300 seconds |
|
|
192
|
-
| Range | 0 (disabled) – 3600 seconds |
|
|
193
|
-
| Cache key (TOKEN) | Header value from token source |
|
|
194
|
-
| Cache key (REQUEST) | All specified identity sources combined |
|
|
195
|
-
| **Critical** | Cached policy applies to **ALL methods/resources** |
|
|
196
|
-
|
|
197
|
-
If any specified identity source is missing/null/empty → 401 returned **without** invoking Lambda.
|
|
198
|
-
|
|
199
|
-
### REQUEST Authorizer — Python
|
|
200
|
-
|
|
201
|
-
```python
|
|
202
|
-
def lambda_handler(event, context):
|
|
203
|
-
token = event["headers"].get("Authorization", "")
|
|
204
|
-
is_authorized = verify_token(token) # Your auth logic
|
|
205
|
-
|
|
206
|
-
return {
|
|
207
|
-
"principalId": "user",
|
|
208
|
-
"policyDocument": {
|
|
209
|
-
"Version": "2012-10-17",
|
|
210
|
-
"Statement": [{
|
|
211
|
-
"Action": "execute-api:Invoke",
|
|
212
|
-
"Effect": "Allow" if is_authorized else "Deny",
|
|
213
|
-
"Resource": event["methodArn"],
|
|
214
|
-
}],
|
|
215
|
-
},
|
|
216
|
-
"context": {"userId": "user", "scope": "read:items"},
|
|
217
|
-
}
|
|
218
|
-
```
|
|
52
|
+
## Throttling and quotas
|
|
219
53
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
```typescript
|
|
223
|
-
import { APIGatewayAuthorizerResult, APIGatewayRequestAuthorizerEvent } from "aws-lambda";
|
|
224
|
-
|
|
225
|
-
export const handler = async (
|
|
226
|
-
event: APIGatewayRequestAuthorizerEvent
|
|
227
|
-
): Promise<APIGatewayAuthorizerResult> => {
|
|
228
|
-
const token = event.headers?.Authorization ?? "";
|
|
229
|
-
const isAuthorized = verifyToken(token); // Your auth logic
|
|
230
|
-
|
|
231
|
-
return {
|
|
232
|
-
principalId: "user",
|
|
233
|
-
policyDocument: {
|
|
234
|
-
Version: "2012-10-17",
|
|
235
|
-
Statement: [{
|
|
236
|
-
Action: "execute-api:Invoke",
|
|
237
|
-
Effect: isAuthorized ? "Allow" : "Deny",
|
|
238
|
-
Resource: event.methodArn,
|
|
239
|
-
}],
|
|
240
|
-
},
|
|
241
|
-
context: { userId: "user", scope: "read:items" },
|
|
242
|
-
};
|
|
243
|
-
};
|
|
244
|
-
```
|
|
54
|
+
Throttling applies most-specific → least-specific: per-client/method (usage plan + API key, REST only) → per-method → account-level → AWS Regional (hard). Token bucket: empty bucket → `429 Too Many Requests`; burst allows temporary spikes.
|
|
245
55
|
|
|
246
|
-
###
|
|
247
|
-
|
|
248
|
-
No Lambda function needed. Configure directly on the API:
|
|
249
|
-
|
|
250
|
-
```yaml
|
|
251
|
-
# SAM / CloudFormation
|
|
252
|
-
MyHttpApi:
|
|
253
|
-
Type: AWS::Serverless::HttpApi
|
|
254
|
-
Properties:
|
|
255
|
-
Auth:
|
|
256
|
-
DefaultAuthorizer: MyJwtAuth
|
|
257
|
-
Authorizers:
|
|
258
|
-
MyJwtAuth:
|
|
259
|
-
AuthorizationScopes:
|
|
260
|
-
- read:items
|
|
261
|
-
IdentitySource: $request.header.Authorization
|
|
262
|
-
JwtConfiguration:
|
|
263
|
-
issuer: https://cognito-idp.us-east-1.amazonaws.com/us-east-1_abc123
|
|
264
|
-
audience:
|
|
265
|
-
- my-client-id
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
Supports any OIDC-compliant IdP (Cognito, Auth0, Okta, etc.).
|
|
269
|
-
|
|
270
|
-
---
|
|
56
|
+
### Account-level
|
|
271
57
|
|
|
272
|
-
|
|
58
|
+
Confirm the current account-level steady-state RPS and burst limits for the Region rather than assuming a default — they vary by Region and are adjustable:
|
|
273
59
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
```
|
|
277
|
-
Most specific → Least specific:
|
|
278
|
-
|
|
279
|
-
1. Per-client / per-method (usage plan + API key) ← REST only
|
|
280
|
-
2. Per-method (stage method settings)
|
|
281
|
-
3. Account-level (all APIs in account/Region)
|
|
282
|
-
4. AWS Regional (hard limit, not changeable)
|
|
60
|
+
```bash
|
|
61
|
+
aws service-quotas get-service-quota --service-code apigateway --quota-code L-8A5B8E43
|
|
283
62
|
```
|
|
284
63
|
|
|
285
|
-
###
|
|
286
|
-
|
|
287
|
-
- Tokens added at steady-state rate (RPS)
|
|
288
|
-
- Bucket holds up to burst capacity
|
|
289
|
-
- Each request = 1 token
|
|
290
|
-
- Empty bucket → `429 Too Many Requests`
|
|
291
|
-
- Burst allows temporary spikes above steady-state
|
|
292
|
-
|
|
293
|
-
### Account-Level Defaults
|
|
294
|
-
|
|
295
|
-
| Quota | Default | Adjustable? |
|
|
296
|
-
|---|---|---|
|
|
297
|
-
| Steady-state RPS (per Region) | 10,000 | Yes |
|
|
298
|
-
| Burst capacity | 5,000 | Set by AWS based on RPS |
|
|
299
|
-
| Smaller Regions (Cape Town, Milan, Jakarta…) | 2,500 RPS / 1,250 burst | Yes |
|
|
300
|
-
|
|
301
|
-
### REST API Quotas
|
|
64
|
+
### REST API
|
|
302
65
|
|
|
303
66
|
| Resource | Default | Adjustable? |
|
|
304
67
|
|---|---|---|
|
|
305
|
-
| Integration timeout | 50ms–29s (default 29s) | Yes (Regional/private only) |
|
|
306
|
-
| Payload size | 10 MB | No |
|
|
307
|
-
| Header value size | 10,240 bytes | No |
|
|
308
|
-
| Cache TTL | 0–3600s | No |
|
|
309
68
|
| Resources per API | 300 | Yes |
|
|
310
69
|
| Stages per API | 10 | Yes |
|
|
311
70
|
| API keys per account | 10,000 | No |
|
|
312
71
|
| Usage plans per account | 300 | Yes |
|
|
313
72
|
| Custom domains per Region | 120 | Yes |
|
|
73
|
+
| Header value size | 10,240 bytes | No |
|
|
74
|
+
| Cache TTL | 0–3600s | No |
|
|
314
75
|
| Mapping template size | 300 KB | No |
|
|
315
76
|
|
|
316
|
-
### HTTP API
|
|
77
|
+
### HTTP API
|
|
317
78
|
|
|
318
79
|
| Resource | Default | Adjustable? |
|
|
319
80
|
|---|---|---|
|
|
320
|
-
| Integration timeout | 30s max | No |
|
|
321
|
-
| Payload size | 10 MB | No |
|
|
322
81
|
| Routes per API | 300 | Yes |
|
|
323
82
|
| Stages per API | 10 | Yes |
|
|
324
83
|
| Integrations per API | 300 | No |
|
|
325
84
|
| Custom domains per Region | 120 | Yes |
|
|
326
85
|
| VPC links per Region | 10 | Yes |
|
|
327
86
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
- Per-client rate limits (RPS) and burst limits via API keys
|
|
331
|
-
- Daily/weekly/monthly quotas per key
|
|
332
|
-
- Method-level throttling within a plan (e.g., `GET /pets` = 100 RPS)
|
|
333
|
-
|
|
334
|
-
### Client-Side 429 Handling
|
|
335
|
-
|
|
336
|
-
- Exponential backoff with jitter
|
|
337
|
-
- Respect `Retry-After` header
|
|
338
|
-
- Client-side rate limiting to stay under known limits
|
|
87
|
+
Client-side 429 handling: exponential backoff with jitter, respect `Retry-After`, rate-limit to stay under known limits.
|
|
339
88
|
|
|
340
89
|
---
|
|
341
90
|
|
|
342
|
-
##
|
|
343
|
-
|
|
344
|
-
### Route Architecture
|
|
91
|
+
## Lambda authorizers
|
|
345
92
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
### Route Selection
|
|
354
|
-
|
|
355
|
-
- Expression: `$request.body.action` (routes on JSON `action` field)
|
|
356
|
-
- Non-JSON messages → always `$default`
|
|
357
|
-
|
|
358
|
-
### Predefined Routes
|
|
359
|
-
|
|
360
|
-
| Route | When | Required? | Notes |
|
|
361
|
-
|---|---|---|---|
|
|
362
|
-
| `$connect` | Connection initiated | No | Auth here; connection pending until integration completes |
|
|
363
|
-
| `$disconnect` | Connection closed | No | Best-effort; connection already closed |
|
|
364
|
-
| `$default` | No matching route / non-JSON | No | Catch-all fallback |
|
|
365
|
-
|
|
366
|
-
### Connection Management — Python
|
|
367
|
-
|
|
368
|
-
```python
|
|
369
|
-
import boto3, json
|
|
370
|
-
|
|
371
|
-
dynamodb = boto3.resource("dynamodb")
|
|
372
|
-
table = dynamodb.Table("WebSocketConnections")
|
|
373
|
-
|
|
374
|
-
def connect_handler(event, context):
|
|
375
|
-
table.put_item(Item={"connectionId": event["requestContext"]["connectionId"]})
|
|
376
|
-
return {"statusCode": 200, "body": "Connected"}
|
|
93
|
+
| Feature | TOKEN | REQUEST |
|
|
94
|
+
|---|---|---|
|
|
95
|
+
| Identity source | Single header (bearer token) | Headers, query strings, stage vars, `$context` |
|
|
96
|
+
| Cache key | Token header value | All specified identity sources combined |
|
|
97
|
+
| Available on | REST API only | REST API + HTTP API |
|
|
98
|
+
| Recommendation | Legacy | **Preferred for new APIs** |
|
|
377
99
|
|
|
378
|
-
|
|
379
|
-
client = boto3.client("apigatewaymanagementapi", endpoint_url=endpoint_url)
|
|
380
|
-
client.post_to_connection(
|
|
381
|
-
ConnectionId=connection_id,
|
|
382
|
-
Data=json.dumps(data).encode("utf-8"),
|
|
383
|
-
)
|
|
384
|
-
```
|
|
100
|
+
Caching: default TTL **300s** (range 0–3600). **A cached policy applies to ALL methods/resources.** If any specified identity source is missing/null/empty → **401 without invoking Lambda**.
|
|
385
101
|
|
|
386
|
-
|
|
102
|
+
The authorizer must return an IAM policy: `{ principalId, policyDocument: { Version, Statement: [{ Action: "execute-api:Invoke", Effect: "Allow"|"Deny", Resource: methodArn }] }, context: {...} }`. HTTP API JWT authorizers need no Lambda — configure `issuer` + `audience` directly on the API.
|
|
387
103
|
|
|
388
|
-
|
|
389
|
-
import { ApiGatewayManagementApiClient, PostToConnectionCommand } from "@aws-sdk/client-apigatewaymanagementapi";
|
|
104
|
+
---
|
|
390
105
|
|
|
391
|
-
|
|
392
|
-
const client = new ApiGatewayManagementApiClient({ endpoint });
|
|
393
|
-
await client.send(new PostToConnectionCommand({
|
|
394
|
-
ConnectionId: connectionId,
|
|
395
|
-
Data: Buffer.from(JSON.stringify(data)),
|
|
396
|
-
}));
|
|
397
|
-
}
|
|
398
|
-
```
|
|
106
|
+
## WebSocket APIs
|
|
399
107
|
|
|
400
|
-
|
|
108
|
+
Routes: `$connect` (auth, store connectionId), `$disconnect` (best-effort cleanup), `$default` (catch-all / non-JSON), plus custom routes selected by `$request.body.action`. Server pushes via the `@connections` API (`PostToConnectionCommand` / `post_to_connection`).
|
|
401
109
|
|
|
402
|
-
|
|
|
110
|
+
| Limit | Value |
|
|
403
111
|
|---|---|
|
|
404
112
|
| Idle connection timeout | 10 minutes |
|
|
405
113
|
| Max connection duration | 2 hours |
|
|
406
114
|
| Message payload | 128 KB (hard limit) |
|
|
407
115
|
|
|
408
|
-
|
|
116
|
+
Close codes: **1001** idle/max-duration, 1003 unsupported binary, 1006 abnormal (no close frame), **1008** throttled, **1009** message too large, 1011 internal error, 1012 service restart.
|
|
409
117
|
|
|
410
|
-
|
|
411
|
-
|---|---|
|
|
412
|
-
| 1001 | Idle timeout or max duration exceeded |
|
|
413
|
-
| 1003 | Unsupported binary media type |
|
|
414
|
-
| 1005 | No status code present (reserved, not sent on wire) |
|
|
415
|
-
| 1006 | Abnormal closure — no close frame received |
|
|
416
|
-
| 1008 | Throttled (too many requests) |
|
|
417
|
-
| 1009 | Message exceeds size limit |
|
|
418
|
-
| 1011 | Internal server error |
|
|
419
|
-
| 1012 | Service restart |
|
|
118
|
+
Store `connectionId` in DynamoDB with a **TTL attribute set to now + 7200s** (the 2-hour max duration) so stale connections are auto-cleaned even when `$disconnect` is missed — enable DynamoDB TTL on that attribute.
|
|
420
119
|
|
|
421
120
|
---
|
|
422
121
|
|
|
423
|
-
##
|
|
424
|
-
|
|
425
|
-
### 502 Bad Gateway — Flowchart
|
|
122
|
+
## CORS gotchas
|
|
426
123
|
|
|
427
|
-
|
|
428
|
-
502 Bad Gateway
|
|
429
|
-
│
|
|
430
|
-
├─ Lambda proxy integration?
|
|
431
|
-
│ └─ YES → Check response format (most common cause):
|
|
432
|
-
│ ├─ statusCode: integer (string is coerced, missing defaults to 200)
|
|
433
|
-
│ ├─ headers: object with string values
|
|
434
|
-
│ ├─ body: string (JSON.stringify, not raw object)
|
|
435
|
-
│ └─ Unhandled exception? → Check CloudWatch Logs
|
|
436
|
-
│
|
|
437
|
-
├─ Lambda authorizer?
|
|
438
|
-
│ ├─ Must return valid IAM policy format
|
|
439
|
-
│ ├─ Check authorizer Lambda logs
|
|
440
|
-
│ └─ Authorizer timeout is separate from integration timeout
|
|
441
|
-
│
|
|
442
|
-
├─ HTTP integration?
|
|
443
|
-
│ ├─ Backend reachable from API Gateway?
|
|
444
|
-
│ ├─ Valid HTTP response from backend?
|
|
445
|
-
│ └─ VPC link healthy? (private integration)
|
|
446
|
-
│
|
|
447
|
-
└─ Other causes:
|
|
448
|
-
├─ Payload > 10 MB
|
|
449
|
-
├─ Binary media types */* (breaks OPTIONS)
|
|
450
|
-
└─ Stage variable → wrong Lambda alias
|
|
451
|
-
```
|
|
452
|
-
|
|
453
|
-
### Correct Lambda Response Format
|
|
454
|
-
|
|
455
|
-
The **most common cause of 502** is an incorrect response format in Lambda proxy integrations.
|
|
456
|
-
|
|
457
|
-
**Python — Correct:**
|
|
458
|
-
|
|
459
|
-
```python
|
|
460
|
-
def handler(event, context):
|
|
461
|
-
return {
|
|
462
|
-
"isBase64Encoded": False, # boolean
|
|
463
|
-
"statusCode": 200, # integer, NOT string
|
|
464
|
-
"headers": { # object with string values
|
|
465
|
-
"Content-Type": "application/json",
|
|
466
|
-
},
|
|
467
|
-
"body": json.dumps({"key": "val"}) # MUST be string
|
|
468
|
-
}
|
|
469
|
-
```
|
|
124
|
+
The common, non-obvious failures (basic header setup is well understood):
|
|
470
125
|
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
headers: { "Content-Type": "application/json" },
|
|
478
|
-
body: JSON.stringify({ key: "val" }), // MUST be string
|
|
479
|
-
});
|
|
480
|
-
```
|
|
481
|
-
|
|
482
|
-
**Common mistakes -> 502:**
|
|
483
|
-
|
|
484
|
-
```python
|
|
485
|
-
return {"statusCode": 200, "body": {"key": "val"}} # body not a string -> 502
|
|
486
|
-
return "just a string" # not a JSON object -> 502
|
|
487
|
-
# Note: string statusCode ("200") and missing statusCode are silently handled (no 502)
|
|
488
|
-
```
|
|
489
|
-
|
|
490
|
-
### 504 Timeout — Flowchart
|
|
491
|
-
|
|
492
|
-
```
|
|
493
|
-
504 Endpoint Request Timed Out
|
|
494
|
-
│
|
|
495
|
-
├─ Step 1: Enable CloudWatch logging
|
|
496
|
-
│ ├─ REST: execution logs + access logs
|
|
497
|
-
│ ├─ HTTP: access logs only
|
|
498
|
-
│ └─ Include: $context.integrationLatency, $context.integration.status
|
|
499
|
-
│
|
|
500
|
-
├─ Step 2: Identify timeout source
|
|
501
|
-
│ ├─ REST API: integration timeout configurable 50ms–29s
|
|
502
|
-
│ ├─ HTTP API: 30s max (can be lowered, cannot be raised)
|
|
503
|
-
│ └─ Was integration invoked?
|
|
504
|
-
│ ├─ NO → Transient network failure; retry
|
|
505
|
-
│ └─ YES → Backend too slow
|
|
506
|
-
│
|
|
507
|
-
├─ Step 3: Reduce integration runtime
|
|
508
|
-
│ ├─ Move non-critical work to async (SQS, Step Functions)
|
|
509
|
-
│ ├─ Increase Lambda memory (faster CPU)
|
|
510
|
-
│ ├─ Provisioned concurrency (eliminate cold starts)
|
|
511
|
-
│ └─ Check downstream dependencies (DB, external APIs)
|
|
512
|
-
│
|
|
513
|
-
└─ Step 4: Increase timeout (REST only)
|
|
514
|
-
├─ Request via Service Quotas console
|
|
515
|
-
├─ Update integration timeout value AND redeploy
|
|
516
|
-
└─ Note: may reduce account throttle quota
|
|
517
|
-
```
|
|
518
|
-
|
|
519
|
-
### CloudWatch Insights Queries
|
|
520
|
-
|
|
521
|
-
**Find all 5xx errors:**
|
|
522
|
-
|
|
523
|
-
```
|
|
524
|
-
fields @timestamp, @message, @logStream
|
|
525
|
-
| filter status >= 500 and status < 600
|
|
526
|
-
| sort @timestamp desc
|
|
527
|
-
| display @timestamp, httpMethod, resourcePath, status, requestId
|
|
528
|
-
```
|
|
529
|
-
|
|
530
|
-
**Find timeout errors:**
|
|
531
|
-
|
|
532
|
-
```
|
|
533
|
-
fields @timestamp, @message
|
|
534
|
-
| filter @message like "Execution failed due to a timeout error"
|
|
535
|
-
| sort @timestamp desc
|
|
536
|
-
```
|
|
537
|
-
|
|
538
|
-
**Find slow integrations (>10s):**
|
|
539
|
-
|
|
540
|
-
```
|
|
541
|
-
fields @timestamp, integrationLatency, status, resourcePath
|
|
542
|
-
| filter integrationLatency > 10000
|
|
543
|
-
| sort integrationLatency desc
|
|
544
|
-
```
|
|
545
|
-
|
|
546
|
-
### Automated Troubleshooting
|
|
547
|
-
|
|
548
|
-
**AWSSupport-TroubleshootAPIGatewayHttpErrors** — Systems Manager runbook:
|
|
126
|
+
| Mistake | Fix |
|
|
127
|
+
|---|---|
|
|
128
|
+
| Binary media types `*/*` break OPTIONS (502) | Set `contentHandling: CONVERT_TO_TEXT` on the OPTIONS integration |
|
|
129
|
+
| `Allow-Origin: *` with `credentials: include` | Specify the exact origin, not a wildcard |
|
|
130
|
+
| Not redeploying after CORS changes | Redeploy the stage |
|
|
131
|
+
| Gateway 4XX/5XX responses lack CORS headers | Add CORS headers to gateway responses too |
|
|
549
132
|
|
|
550
|
-
-
|
|
551
|
-
- Analyzes CloudWatch logs automatically
|
|
552
|
-
- Requires: `apigateway:GET`, `logs:GetQueryResults`, `logs:StartQuery`, `ssm:*`
|
|
553
|
-
- Available in Systems Manager console → Automation
|
|
133
|
+
For the full step-by-step procedure of wiring CORS, throttling, and access logging when connecting a Lambda, use the **connecting-lambda-to-api-gateway** skill (see SKILL.md routing). For 502/504 deep debugging, see [troubleshooting.md](troubleshooting.md).
|