@jaypie/mcp 0.3.2 → 0.3.4
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/aws-B3dW_-bD.js +1202 -0
- package/dist/aws-B3dW_-bD.js.map +1 -0
- package/dist/index.js +166 -1209
- package/dist/index.js.map +1 -1
- package/dist/suite.d.ts +1 -0
- package/dist/suite.js +1252 -0
- package/dist/suite.js.map +1 -0
- package/package.json +8 -2
- package/prompts/Jaypie_Fabric_Package.md +86 -0
- package/release-notes/constructs/1.2.17.md +11 -0
- package/release-notes/fabric/0.1.2.md +11 -0
- package/release-notes/mcp/0.3.3.md +12 -0
- package/release-notes/mcp/0.3.4.md +36 -0
- package/skills/agents.md +25 -0
- package/skills/aws.md +107 -0
- package/skills/cdk.md +141 -0
- package/skills/cicd.md +152 -0
- package/skills/datadog.md +129 -0
- package/skills/debugging.md +148 -0
- package/skills/dns.md +134 -0
- package/skills/dynamodb.md +140 -0
- package/skills/errors.md +142 -0
- package/skills/fabric.md +164 -0
- package/skills/index.md +7 -0
- package/skills/jaypie.md +100 -0
- package/skills/legacy.md +97 -0
- package/skills/logs.md +160 -0
- package/skills/mocks.md +174 -0
- package/skills/models.md +195 -0
- package/skills/releasenotes.md +94 -0
- package/skills/secrets.md +155 -0
- package/skills/services.md +175 -0
- package/skills/style.md +190 -0
- package/skills/tests.md +209 -0
- package/skills/tools.md +127 -0
- package/skills/topics.md +116 -0
- package/skills/variables.md +146 -0
- package/skills/writing.md +153 -0
package/skills/cdk.md
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: CDK constructs and deployment patterns
|
|
3
|
+
related: aws, dynamodb, cicd
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# CDK Constructs
|
|
7
|
+
|
|
8
|
+
Jaypie provides CDK constructs through `@jaypie/constructs` for deploying AWS infrastructure with best practices built-in.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @jaypie/constructs
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Core Constructs
|
|
17
|
+
|
|
18
|
+
### JaypieLambda
|
|
19
|
+
|
|
20
|
+
Lambda function with Datadog tracing, logging, and error handling:
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import { JaypieLambda } from "@jaypie/constructs";
|
|
24
|
+
|
|
25
|
+
const handler = new JaypieLambda(this, "ApiHandler", {
|
|
26
|
+
entry: "src/handler.ts",
|
|
27
|
+
handler: "handler",
|
|
28
|
+
environment: {
|
|
29
|
+
PROJECT_ENV: "production",
|
|
30
|
+
PROJECT_KEY: "my-api",
|
|
31
|
+
},
|
|
32
|
+
timeout: Duration.seconds(30),
|
|
33
|
+
memorySize: 512,
|
|
34
|
+
});
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### JaypieQueue
|
|
38
|
+
|
|
39
|
+
SQS queue with DLQ and Lambda trigger:
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
import { JaypieQueue } from "@jaypie/constructs";
|
|
43
|
+
|
|
44
|
+
const queue = new JaypieQueue(this, "ProcessQueue", {
|
|
45
|
+
visibilityTimeout: Duration.seconds(60),
|
|
46
|
+
retentionPeriod: Duration.days(7),
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// Connect to Lambda
|
|
50
|
+
queue.addEventSource(handler);
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### JaypieBucket
|
|
54
|
+
|
|
55
|
+
S3 bucket with encryption and lifecycle rules:
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
import { JaypieBucket } from "@jaypie/constructs";
|
|
59
|
+
|
|
60
|
+
const bucket = new JaypieBucket(this, "AssetsBucket", {
|
|
61
|
+
encryption: BucketEncryption.S3_MANAGED,
|
|
62
|
+
lifecycleRules: [
|
|
63
|
+
{ expiration: Duration.days(90), prefix: "temp/" }
|
|
64
|
+
],
|
|
65
|
+
});
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Stack Structure
|
|
69
|
+
|
|
70
|
+
Organize stacks in the `stacks/` directory:
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
stacks/
|
|
74
|
+
├── cdk/
|
|
75
|
+
│ ├── src/
|
|
76
|
+
│ │ ├── app.ts # CDK app entry
|
|
77
|
+
│ │ └── stacks/
|
|
78
|
+
│ │ ├── api.ts # API stack
|
|
79
|
+
│ │ └── data.ts # Data stack
|
|
80
|
+
│ ├── cdk.json
|
|
81
|
+
│ └── package.json
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Environment Configuration
|
|
85
|
+
|
|
86
|
+
Use environment-specific configuration:
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
const env = process.env.PROJECT_ENV || "sandbox";
|
|
90
|
+
const nonce = process.env.PROJECT_NONCE || "dev";
|
|
91
|
+
|
|
92
|
+
const stack = new ApiStack(app, `api-${env}-${nonce}`, {
|
|
93
|
+
env: {
|
|
94
|
+
account: process.env.CDK_DEFAULT_ACCOUNT,
|
|
95
|
+
region: process.env.CDK_DEFAULT_REGION,
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Deployment
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
# Deploy to sandbox
|
|
104
|
+
PROJECT_ENV=sandbox PROJECT_NONCE=dev cdk deploy
|
|
105
|
+
|
|
106
|
+
# Deploy to production
|
|
107
|
+
PROJECT_ENV=production PROJECT_NONCE=prod cdk deploy
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Environment Variables
|
|
111
|
+
|
|
112
|
+
Pass configuration to Lambda via environment variables:
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
const handler = new JaypieLambda(this, "Handler", {
|
|
116
|
+
environment: {
|
|
117
|
+
CDK_ENV_BUCKET: bucket.bucketName,
|
|
118
|
+
CDK_ENV_QUEUE_URL: queue.queueUrl,
|
|
119
|
+
SECRET_MONGODB_URI: "mongodb-connection-string",
|
|
120
|
+
},
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
// Grant permissions
|
|
124
|
+
bucket.grantReadWrite(handler);
|
|
125
|
+
queue.grantSendMessages(handler);
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Datadog Integration
|
|
129
|
+
|
|
130
|
+
Enable Datadog tracing:
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
const handler = new JaypieLambda(this, "Handler", {
|
|
134
|
+
datadogApiKeyArn: "arn:aws:secretsmanager:...",
|
|
135
|
+
environment: {
|
|
136
|
+
DD_ENV: "production",
|
|
137
|
+
DD_SERVICE: "my-api",
|
|
138
|
+
},
|
|
139
|
+
});
|
|
140
|
+
```
|
|
141
|
+
|
package/skills/cicd.md
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: GitHub Actions CI/CD workflows
|
|
3
|
+
related: tests, cdk
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# CI/CD with GitHub Actions
|
|
7
|
+
|
|
8
|
+
Jaypie projects use GitHub Actions for continuous integration and deployment.
|
|
9
|
+
|
|
10
|
+
## Standard Workflows
|
|
11
|
+
|
|
12
|
+
### npm-check.yml
|
|
13
|
+
|
|
14
|
+
Runs on feature branches (`feat/*`, `fix/*`, `devin/*`):
|
|
15
|
+
|
|
16
|
+
```yaml
|
|
17
|
+
name: npm-check
|
|
18
|
+
|
|
19
|
+
on:
|
|
20
|
+
push:
|
|
21
|
+
branches:
|
|
22
|
+
- 'feat/*'
|
|
23
|
+
- 'fix/*'
|
|
24
|
+
|
|
25
|
+
jobs:
|
|
26
|
+
lint:
|
|
27
|
+
runs-on: ubuntu-latest
|
|
28
|
+
steps:
|
|
29
|
+
- uses: actions/checkout@v4
|
|
30
|
+
- uses: actions/setup-node@v4
|
|
31
|
+
with:
|
|
32
|
+
node-version: 24
|
|
33
|
+
- run: npm ci
|
|
34
|
+
- run: npm run lint
|
|
35
|
+
|
|
36
|
+
typecheck:
|
|
37
|
+
runs-on: ubuntu-latest
|
|
38
|
+
steps:
|
|
39
|
+
- uses: actions/checkout@v4
|
|
40
|
+
- uses: actions/setup-node@v4
|
|
41
|
+
with:
|
|
42
|
+
node-version: 24
|
|
43
|
+
- run: npm ci
|
|
44
|
+
- run: npm run typecheck
|
|
45
|
+
|
|
46
|
+
test:
|
|
47
|
+
runs-on: ubuntu-latest
|
|
48
|
+
strategy:
|
|
49
|
+
matrix:
|
|
50
|
+
node-version: [22, 24, 25]
|
|
51
|
+
steps:
|
|
52
|
+
- uses: actions/checkout@v4
|
|
53
|
+
- uses: actions/setup-node@v4
|
|
54
|
+
with:
|
|
55
|
+
node-version: ${{ matrix.node-version }}
|
|
56
|
+
- run: npm ci
|
|
57
|
+
- run: npm run build
|
|
58
|
+
- run: npm test
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### npm-deploy.yml
|
|
62
|
+
|
|
63
|
+
Runs on `main` branch and release tags:
|
|
64
|
+
|
|
65
|
+
```yaml
|
|
66
|
+
name: npm-deploy
|
|
67
|
+
|
|
68
|
+
on:
|
|
69
|
+
push:
|
|
70
|
+
branches: [main]
|
|
71
|
+
tags:
|
|
72
|
+
- 'deploy-*'
|
|
73
|
+
- 'rc-*'
|
|
74
|
+
|
|
75
|
+
jobs:
|
|
76
|
+
publish:
|
|
77
|
+
runs-on: ubuntu-latest
|
|
78
|
+
permissions:
|
|
79
|
+
contents: read
|
|
80
|
+
id-token: write
|
|
81
|
+
steps:
|
|
82
|
+
- uses: actions/checkout@v4
|
|
83
|
+
- uses: actions/setup-node@v4
|
|
84
|
+
with:
|
|
85
|
+
node-version: 24
|
|
86
|
+
registry-url: 'https://registry.npmjs.org'
|
|
87
|
+
- run: npm ci
|
|
88
|
+
- run: npm run build
|
|
89
|
+
- run: npm publish --provenance
|
|
90
|
+
env:
|
|
91
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Branch Strategy
|
|
95
|
+
|
|
96
|
+
| Branch Pattern | Purpose | Triggers |
|
|
97
|
+
|---------------|---------|----------|
|
|
98
|
+
| `main` | Production releases | npm-deploy |
|
|
99
|
+
| `feat/*` | Feature development | npm-check |
|
|
100
|
+
| `fix/*` | Bug fixes | npm-check |
|
|
101
|
+
| `rc-*` tags | Release candidates | npm-deploy (--tag rc) |
|
|
102
|
+
|
|
103
|
+
## Testing Matrix
|
|
104
|
+
|
|
105
|
+
Test across multiple Node.js versions:
|
|
106
|
+
|
|
107
|
+
```yaml
|
|
108
|
+
strategy:
|
|
109
|
+
matrix:
|
|
110
|
+
node-version: [22, 24, 25]
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Secrets Configuration
|
|
114
|
+
|
|
115
|
+
Required repository secrets:
|
|
116
|
+
|
|
117
|
+
| Secret | Purpose |
|
|
118
|
+
|--------|---------|
|
|
119
|
+
| `NPM_TOKEN` | npm publish authentication |
|
|
120
|
+
| `DATADOG_API_KEY` | Optional: Test tracing |
|
|
121
|
+
|
|
122
|
+
## Workflow Tips
|
|
123
|
+
|
|
124
|
+
### Skip Already-Published Versions
|
|
125
|
+
|
|
126
|
+
```yaml
|
|
127
|
+
- run: |
|
|
128
|
+
CURRENT=$(npm view ${{ github.repository }} version 2>/dev/null || echo "0.0.0")
|
|
129
|
+
LOCAL=$(node -p "require('./package.json').version")
|
|
130
|
+
if [ "$CURRENT" = "$LOCAL" ]; then
|
|
131
|
+
echo "Version already published, skipping"
|
|
132
|
+
exit 0
|
|
133
|
+
fi
|
|
134
|
+
npm publish --provenance
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Conditional Job Execution
|
|
138
|
+
|
|
139
|
+
Run jobs only when specific files change:
|
|
140
|
+
|
|
141
|
+
```yaml
|
|
142
|
+
- uses: dorny/paths-filter@v2
|
|
143
|
+
id: changes
|
|
144
|
+
with:
|
|
145
|
+
filters: |
|
|
146
|
+
src:
|
|
147
|
+
- 'packages/llm/**'
|
|
148
|
+
|
|
149
|
+
- run: npm test -w packages/llm
|
|
150
|
+
if: steps.changes.outputs.src == 'true'
|
|
151
|
+
```
|
|
152
|
+
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Datadog integration and observability
|
|
3
|
+
related: logs, debugging, aws
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Datadog Integration
|
|
7
|
+
|
|
8
|
+
Jaypie integrates with Datadog for logging, monitoring, and APM.
|
|
9
|
+
|
|
10
|
+
## MCP Datadog Tools
|
|
11
|
+
|
|
12
|
+
The Jaypie MCP provides tools for querying Datadog:
|
|
13
|
+
|
|
14
|
+
### Log Search
|
|
15
|
+
```
|
|
16
|
+
datadog_logs - Search individual log entries
|
|
17
|
+
datadog_log_analytics - Aggregate logs with groupBy
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Monitoring
|
|
21
|
+
```
|
|
22
|
+
datadog_monitors - List and check monitor status
|
|
23
|
+
datadog_synthetics - List synthetic tests and results
|
|
24
|
+
datadog_metrics - Query timeseries metrics
|
|
25
|
+
datadog_rum - Search Real User Monitoring events
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Environment Variables
|
|
29
|
+
|
|
30
|
+
Configure Datadog tools via environment:
|
|
31
|
+
|
|
32
|
+
| Variable | Description |
|
|
33
|
+
|----------|-------------|
|
|
34
|
+
| `DATADOG_API_KEY` or `DD_API_KEY` | API key |
|
|
35
|
+
| `DATADOG_APP_KEY` or `DD_APP_KEY` | Application key |
|
|
36
|
+
| `DD_ENV` | Default environment filter |
|
|
37
|
+
| `DD_SERVICE` | Default service filter |
|
|
38
|
+
| `DD_SOURCE` | Default log source (default: lambda) |
|
|
39
|
+
|
|
40
|
+
## Common Queries
|
|
41
|
+
|
|
42
|
+
### Search Error Logs
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
datadog_logs --query "status:error" --from "now-1h"
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Count Errors by Service
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
datadog_log_analytics --groupBy '["service"]' --query "status:error"
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Check Alerting Monitors
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
datadog_monitors --status '["Alert", "Warn"]'
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Lambda Integration
|
|
61
|
+
|
|
62
|
+
Enable Datadog tracing in CDK:
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
import { JaypieLambda } from "@jaypie/constructs";
|
|
66
|
+
|
|
67
|
+
const handler = new JaypieLambda(this, "Handler", {
|
|
68
|
+
datadogApiKeyArn: process.env.CDK_ENV_DATADOG_API_KEY_ARN,
|
|
69
|
+
environment: {
|
|
70
|
+
DD_ENV: "production",
|
|
71
|
+
DD_SERVICE: "my-api",
|
|
72
|
+
DD_VERSION: "1.0.0",
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Logging Integration
|
|
78
|
+
|
|
79
|
+
Jaypie logging automatically formats for Datadog:
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
import { log } from "jaypie";
|
|
83
|
+
|
|
84
|
+
// Structured logs are indexed by Datadog
|
|
85
|
+
log.info("Request processed", {
|
|
86
|
+
userId: "user-123",
|
|
87
|
+
action: "checkout",
|
|
88
|
+
duration: 150,
|
|
89
|
+
});
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Query Syntax
|
|
93
|
+
|
|
94
|
+
### Log Search Syntax
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
status:error # By status
|
|
98
|
+
@http.status_code:500 # By attribute
|
|
99
|
+
service:my-api # By service
|
|
100
|
+
*timeout* # Wildcard
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Time Ranges
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
now-15m # Last 15 minutes
|
|
107
|
+
now-1h # Last hour
|
|
108
|
+
now-1d # Last day
|
|
109
|
+
2024-01-15T10:00:00Z # Specific time (ISO 8601)
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Unified Service Tagging
|
|
113
|
+
|
|
114
|
+
Use consistent tags across services:
|
|
115
|
+
|
|
116
|
+
| Tag | Purpose |
|
|
117
|
+
|-----|---------|
|
|
118
|
+
| `env` | Environment (sandbox, production) |
|
|
119
|
+
| `service` | Service name |
|
|
120
|
+
| `version` | Deployment version |
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
environment: {
|
|
124
|
+
DD_ENV: process.env.PROJECT_ENV,
|
|
125
|
+
DD_SERVICE: process.env.PROJECT_KEY,
|
|
126
|
+
DD_VERSION: process.env.npm_package_version,
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Debugging techniques and troubleshooting
|
|
3
|
+
related: logs, datadog, errors
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Debugging Techniques
|
|
7
|
+
|
|
8
|
+
Strategies for debugging Jaypie applications.
|
|
9
|
+
|
|
10
|
+
## Log-Based Debugging
|
|
11
|
+
|
|
12
|
+
### Enable Debug Logging
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
LOG_LEVEL=debug npm run dev
|
|
16
|
+
LOG_LEVEL=trace npm run dev # Most verbose
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Search Logs via MCP
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
# Find errors in last hour
|
|
23
|
+
datadog_logs --query "status:error" --from "now-1h"
|
|
24
|
+
|
|
25
|
+
# Find specific request
|
|
26
|
+
datadog_logs --query "@requestId:abc-123"
|
|
27
|
+
|
|
28
|
+
# Search CloudWatch directly
|
|
29
|
+
aws_logs_filter_log_events --logGroupName "/aws/lambda/my-function" --filterPattern "ERROR"
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Common Issues
|
|
33
|
+
|
|
34
|
+
### "undefined" in Stack Names
|
|
35
|
+
|
|
36
|
+
If you see `undefined` in a CDK stack name, a required variable is missing:
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
// BAD: undefined if PROJECT_NONCE not set
|
|
40
|
+
const stackName = `api-${process.env.PROJECT_NONCE}`;
|
|
41
|
+
|
|
42
|
+
// GOOD: Provide default
|
|
43
|
+
const nonce = process.env.PROJECT_NONCE || "dev";
|
|
44
|
+
const stackName = `api-${nonce}`;
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### "unknown" in Logs
|
|
48
|
+
|
|
49
|
+
`unknown` indicates a value was expected but fell back to a default:
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
// This produces "unknown" if PROJECT_KEY not set
|
|
53
|
+
log.info("Starting", { project: process.env.PROJECT_KEY || "unknown" });
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Lambda Cold Starts
|
|
57
|
+
|
|
58
|
+
Check initialization time:
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
datadog_logs --query "@dd.cold_start:true" --from "now-1h"
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Connection Timeouts
|
|
65
|
+
|
|
66
|
+
For database or external service timeouts:
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
// Check Lambda timeout settings
|
|
70
|
+
aws_lambda_get_function --functionName "my-function"
|
|
71
|
+
|
|
72
|
+
// Look for timeout patterns in logs
|
|
73
|
+
datadog_logs --query "timeout OR ETIMEDOUT" --from "now-1h"
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Increase Lambda timeout or optimize slow operations.
|
|
77
|
+
|
|
78
|
+
## Local Testing
|
|
79
|
+
|
|
80
|
+
### Lambda Local Testing
|
|
81
|
+
|
|
82
|
+
Use SAM CLI for local Lambda testing:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
cd packages/express/docker
|
|
86
|
+
sam local invoke -e event.json
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### DynamoDB Local
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Start local DynamoDB
|
|
93
|
+
docker run -p 8000:8000 amazon/dynamodb-local
|
|
94
|
+
|
|
95
|
+
# Access with AWS CLI
|
|
96
|
+
AWS_ACCESS_KEY_ID=local AWS_SECRET_ACCESS_KEY=local \
|
|
97
|
+
aws dynamodb list-tables --endpoint-url http://127.0.0.1:8000
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Stack Traces
|
|
101
|
+
|
|
102
|
+
### Finding Root Cause
|
|
103
|
+
|
|
104
|
+
Jaypie errors include context:
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
try {
|
|
108
|
+
await riskyOperation();
|
|
109
|
+
} catch (error) {
|
|
110
|
+
log.error("Operation failed", {
|
|
111
|
+
error: error.message,
|
|
112
|
+
stack: error.stack,
|
|
113
|
+
context: error.context, // Jaypie errors include this
|
|
114
|
+
});
|
|
115
|
+
throw error;
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Error Classification
|
|
120
|
+
|
|
121
|
+
| Error Type | Cause |
|
|
122
|
+
|------------|-------|
|
|
123
|
+
| ConfigurationError | Missing or invalid config |
|
|
124
|
+
| NotFoundError | Resource doesn't exist |
|
|
125
|
+
| UnauthorizedError | Authentication failed |
|
|
126
|
+
| ForbiddenError | Permission denied |
|
|
127
|
+
| BadRequestError | Invalid input |
|
|
128
|
+
|
|
129
|
+
## Step Function Debugging
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
# List running executions
|
|
133
|
+
aws_stepfunctions_list_executions --stateMachineArn "arn:..." --statusFilter "RUNNING"
|
|
134
|
+
|
|
135
|
+
# Stop stuck execution
|
|
136
|
+
aws_stepfunctions_stop_execution --executionArn "arn:..." --cause "Manual stop for debugging"
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Queue Debugging
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
# Check queue depth
|
|
143
|
+
aws_sqs_get_queue_attributes --queueUrl "https://..."
|
|
144
|
+
|
|
145
|
+
# Peek at messages (does not delete)
|
|
146
|
+
aws_sqs_receive_message --queueUrl "https://..." --maxNumberOfMessages 5
|
|
147
|
+
```
|
|
148
|
+
|
package/skills/dns.md
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: DNS and domain configuration
|
|
3
|
+
related: cdk, aws
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# DNS Configuration
|
|
7
|
+
|
|
8
|
+
Managing domains and DNS for Jaypie applications.
|
|
9
|
+
|
|
10
|
+
## Route 53 Setup
|
|
11
|
+
|
|
12
|
+
### Hosted Zone
|
|
13
|
+
|
|
14
|
+
Create a hosted zone for your domain:
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import { HostedZone } from "aws-cdk-lib/aws-route53";
|
|
18
|
+
|
|
19
|
+
const zone = HostedZone.fromLookup(this, "Zone", {
|
|
20
|
+
domainName: "example.com",
|
|
21
|
+
});
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### CloudFront Alias
|
|
25
|
+
|
|
26
|
+
Point domain to CloudFront distribution:
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
import { ARecord, RecordTarget } from "aws-cdk-lib/aws-route53";
|
|
30
|
+
import { CloudFrontTarget } from "aws-cdk-lib/aws-route53-targets";
|
|
31
|
+
|
|
32
|
+
new ARecord(this, "SiteAlias", {
|
|
33
|
+
zone,
|
|
34
|
+
recordName: "app", // app.example.com
|
|
35
|
+
target: RecordTarget.fromAlias(new CloudFrontTarget(distribution)),
|
|
36
|
+
});
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### API Gateway Custom Domain
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
import { DomainName } from "aws-cdk-lib/aws-apigatewayv2";
|
|
43
|
+
|
|
44
|
+
const domainName = new DomainName(this, "ApiDomain", {
|
|
45
|
+
domainName: "api.example.com",
|
|
46
|
+
certificate: certificate,
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
new ARecord(this, "ApiAlias", {
|
|
50
|
+
zone,
|
|
51
|
+
recordName: "api",
|
|
52
|
+
target: RecordTarget.fromAlias(new ApiGatewayv2DomainProperties(
|
|
53
|
+
domainName.regionalDomainName,
|
|
54
|
+
domainName.regionalHostedZoneId,
|
|
55
|
+
)),
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Certificate Management
|
|
60
|
+
|
|
61
|
+
### ACM Certificate
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
import { Certificate, CertificateValidation } from "aws-cdk-lib/aws-certificatemanager";
|
|
65
|
+
|
|
66
|
+
const certificate = new Certificate(this, "Certificate", {
|
|
67
|
+
domainName: "example.com",
|
|
68
|
+
subjectAlternativeNames: ["*.example.com"],
|
|
69
|
+
validation: CertificateValidation.fromDns(zone),
|
|
70
|
+
});
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Cross-Region Certificates
|
|
74
|
+
|
|
75
|
+
CloudFront requires certificates in `us-east-1`:
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
// In us-east-1 stack
|
|
79
|
+
const cfCertificate = new Certificate(this, "CfCertificate", {
|
|
80
|
+
domainName: "app.example.com",
|
|
81
|
+
validation: CertificateValidation.fromDns(zone),
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
// Export ARN for use in other regions
|
|
85
|
+
new CfnOutput(this, "CertificateArn", {
|
|
86
|
+
value: cfCertificate.certificateArn,
|
|
87
|
+
exportName: "CloudFrontCertificateArn",
|
|
88
|
+
});
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Environment-Based Domains
|
|
92
|
+
|
|
93
|
+
Map environments to subdomains:
|
|
94
|
+
|
|
95
|
+
| Environment | Domain |
|
|
96
|
+
|-------------|--------|
|
|
97
|
+
| production | app.example.com |
|
|
98
|
+
| sandbox | sandbox.example.com |
|
|
99
|
+
| local | localhost:3000 |
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
const subdomain = process.env.PROJECT_ENV === "production"
|
|
103
|
+
? "app"
|
|
104
|
+
: process.env.PROJECT_ENV;
|
|
105
|
+
|
|
106
|
+
new ARecord(this, "Alias", {
|
|
107
|
+
zone,
|
|
108
|
+
recordName: subdomain,
|
|
109
|
+
target: RecordTarget.fromAlias(new CloudFrontTarget(distribution)),
|
|
110
|
+
});
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Debugging DNS
|
|
114
|
+
|
|
115
|
+
### Check DNS Resolution
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
# Check A record
|
|
119
|
+
dig app.example.com A
|
|
120
|
+
|
|
121
|
+
# Check CNAME
|
|
122
|
+
dig app.example.com CNAME
|
|
123
|
+
|
|
124
|
+
# Check with specific nameserver
|
|
125
|
+
dig @ns-123.awsdns-45.com app.example.com
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Verify Certificate
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
# Check certificate
|
|
132
|
+
openssl s_client -connect app.example.com:443 -servername app.example.com
|
|
133
|
+
```
|
|
134
|
+
|