@friggframework/devtools 2.0.0--canary.428.2abc64a.0 → 2.0.0--canary.395.eb0264e.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/infrastructure/README.md +19 -8
- package/infrastructure/aws-discovery.test.js +38 -0
- package/infrastructure/create-frigg-infrastructure.js +0 -2
- package/infrastructure/serverless-template.js +13 -4
- package/package.json +6 -6
- package/test/index.js +2 -4
- package/test/mock-integration.js +4 -14
- package/infrastructure/AWS-DISCOVERY-TROUBLESHOOTING.md +0 -245
- package/infrastructure/AWS-IAM-CREDENTIAL-NEEDS.md +0 -627
- package/infrastructure/README-TESTING.md +0 -332
- package/infrastructure/test-subnet-logic.js +0 -49
- package/test/auther-definition-tester.js +0 -125
package/infrastructure/README.md
CHANGED
|
@@ -61,7 +61,8 @@ infrastructure/
|
|
|
61
61
|
|
|
62
62
|
Generates complete serverless.yml configurations with:
|
|
63
63
|
|
|
64
|
-
- VPC configuration and resource discovery
|
|
64
|
+
- VPC configuration and resource discovery (with optional self-healing)
|
|
65
|
+
- NAT/EIP management strategies (`discover`, `createAndManage`, `useExisting`)
|
|
65
66
|
- KMS encryption for field-level encryption
|
|
66
67
|
- SSM Parameter Store integration
|
|
67
68
|
- Integration-specific functions and queues
|
|
@@ -69,12 +70,13 @@ Generates complete serverless.yml configurations with:
|
|
|
69
70
|
|
|
70
71
|
#### 2. AWS Discovery (`aws-discovery.js`)
|
|
71
72
|
|
|
72
|
-
Automatically discovers existing AWS resources:
|
|
73
|
+
Automatically discovers existing AWS resources and highlights misconfigurations:
|
|
73
74
|
|
|
74
75
|
- Default VPC and security groups
|
|
75
|
-
- Private subnets for Lambda functions
|
|
76
|
+
- Private subnets for Lambda functions (with routing validation)
|
|
76
77
|
- Customer-managed KMS keys
|
|
77
78
|
- Route tables for VPC endpoints
|
|
79
|
+
- NAT gateways / Elastic IPs and whether remediation is required
|
|
78
80
|
|
|
79
81
|
#### 3. Build-Time Discovery (`build-time-discovery.js`)
|
|
80
82
|
|
|
@@ -147,10 +149,18 @@ const appDefinition = {
|
|
|
147
149
|
// VPC configuration
|
|
148
150
|
vpc: {
|
|
149
151
|
enable: true,
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
152
|
+
management: 'discover', // 'discover' | 'create-new' | 'use-existing'
|
|
153
|
+
selfHeal: true, // Let the template repair routing/NAT issues
|
|
154
|
+
securityGroupIds: [...], // Optional: custom security groups or CFN Refs
|
|
155
|
+
subnets: {
|
|
156
|
+
management: 'discover', // 'discover' | 'create' | 'use-existing'
|
|
157
|
+
ids: [...], // Required when management is 'use-existing'
|
|
158
|
+
},
|
|
159
|
+
natGateway: {
|
|
160
|
+
management: 'discover', // 'discover' | 'createAndManage' | 'useExisting'
|
|
161
|
+
id: 'nat-xxxxxxxx', // Required when management is 'useExisting'
|
|
162
|
+
},
|
|
163
|
+
enableVPCEndpoints: true // Optional: create VPC endpoints
|
|
154
164
|
},
|
|
155
165
|
|
|
156
166
|
// KMS encryption
|
|
@@ -164,7 +174,7 @@ const appDefinition = {
|
|
|
164
174
|
enable: true
|
|
165
175
|
},
|
|
166
176
|
|
|
167
|
-
// WebSocket support (
|
|
177
|
+
// WebSocket support (optional)
|
|
168
178
|
websockets: {
|
|
169
179
|
enable: true
|
|
170
180
|
},
|
|
@@ -187,6 +197,7 @@ AWS_DISCOVERY_VPC_ID=vpc-12345678
|
|
|
187
197
|
AWS_DISCOVERY_SECURITY_GROUP_ID=sg-12345678
|
|
188
198
|
AWS_DISCOVERY_SUBNET_ID_1=subnet-12345678
|
|
189
199
|
AWS_DISCOVERY_SUBNET_ID_2=subnet-87654321
|
|
200
|
+
AWS_DISCOVERY_PUBLIC_SUBNET_ID=subnet-abcdef12
|
|
190
201
|
AWS_DISCOVERY_ROUTE_TABLE_ID=rtb-12345678
|
|
191
202
|
AWS_DISCOVERY_KMS_KEY_ID=arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
|
|
192
203
|
|
|
@@ -1036,11 +1036,49 @@ describe('AWSDiscovery', () => {
|
|
|
1036
1036
|
const result = await discovery.discoverResources({ selfHeal: true });
|
|
1037
1037
|
|
|
1038
1038
|
expect(result).toMatchObject({
|
|
1039
|
+
defaultVpcId: 'vpc-12345678',
|
|
1040
|
+
privateSubnetId1: 'subnet-1',
|
|
1041
|
+
privateSubnetId2: 'subnet-2',
|
|
1042
|
+
publicSubnetId: 'subnet-public-1',
|
|
1039
1043
|
subnetConversionRequired: true,
|
|
1040
1044
|
privateSubnetsWithWrongRoutes: ['subnet-1']
|
|
1041
1045
|
});
|
|
1042
1046
|
});
|
|
1043
1047
|
|
|
1048
|
+
it('should surface subnet analysis summary for diagnostic tooling', async () => {
|
|
1049
|
+
const mockVpc = { VpcId: 'vpc-987654321', CidrBlock: '10.0.0.0/16' };
|
|
1050
|
+
const mockSubnets = [
|
|
1051
|
+
{ SubnetId: 'subnet-public-a', AvailabilityZone: 'us-east-1a' },
|
|
1052
|
+
{ SubnetId: 'subnet-private-b', AvailabilityZone: 'us-east-1b' }
|
|
1053
|
+
];
|
|
1054
|
+
const mockSecurityGroup = { GroupId: 'sg-22222222' };
|
|
1055
|
+
const mockRouteTable = { RouteTableId: 'rtb-22222222' };
|
|
1056
|
+
|
|
1057
|
+
jest.spyOn(discovery, 'findDefaultVpc').mockResolvedValue(mockVpc);
|
|
1058
|
+
jest.spyOn(discovery, 'findPrivateSubnets').mockResolvedValue(mockSubnets);
|
|
1059
|
+
jest.spyOn(discovery, 'findPublicSubnets').mockResolvedValue({ SubnetId: 'subnet-nat-home' });
|
|
1060
|
+
jest.spyOn(discovery, 'findDefaultSecurityGroup').mockResolvedValue(mockSecurityGroup);
|
|
1061
|
+
jest.spyOn(discovery, 'findPrivateRouteTable').mockResolvedValue(mockRouteTable);
|
|
1062
|
+
jest.spyOn(discovery, 'findDefaultKmsKey').mockResolvedValue(null);
|
|
1063
|
+
jest.spyOn(discovery, 'findExistingNatGateway').mockResolvedValue({
|
|
1064
|
+
NatGatewayId: 'nat-2222',
|
|
1065
|
+
NatGatewayAddresses: [{ AllocationId: 'eipalloc-2222' }],
|
|
1066
|
+
_isInPrivateSubnet: false
|
|
1067
|
+
});
|
|
1068
|
+
jest.spyOn(discovery, 'isSubnetPrivate')
|
|
1069
|
+
.mockImplementation((subnetId) => subnetId === 'subnet-private-b');
|
|
1070
|
+
|
|
1071
|
+
const result = await discovery.discoverResources({ selfHeal: true });
|
|
1072
|
+
|
|
1073
|
+
expect(result.defaultVpcId).toBe('vpc-987654321');
|
|
1074
|
+
expect(result.subnetConversionRequired).toBe(true);
|
|
1075
|
+
expect(result.privateSubnetsWithWrongRoutes).toEqual(['subnet-public-a']);
|
|
1076
|
+
expect(result.privateSubnetId1).toBe('subnet-public-a');
|
|
1077
|
+
expect(result.privateSubnetId2).toBe('subnet-private-b');
|
|
1078
|
+
expect(result.existingNatGatewayId).toBe('nat-2222');
|
|
1079
|
+
expect(result.existingElasticIpAllocationId).toBe('eipalloc-2222');
|
|
1080
|
+
});
|
|
1081
|
+
|
|
1044
1082
|
it('should handle selfHeal option', async () => {
|
|
1045
1083
|
const mockVpc = { VpcId: 'vpc-12345678' };
|
|
1046
1084
|
const mockSubnets = [
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const fs = require('fs-extra');
|
|
3
3
|
const { composeServerlessDefinition } = require('./serverless-template');
|
|
4
|
-
|
|
5
4
|
const { findNearestBackendPackageJson } = require('@friggframework/core');
|
|
6
5
|
|
|
7
6
|
async function createFriggInfrastructure() {
|
|
@@ -25,7 +24,6 @@ async function createFriggInfrastructure() {
|
|
|
25
24
|
// ));
|
|
26
25
|
const definition = await composeServerlessDefinition(
|
|
27
26
|
appDefinition,
|
|
28
|
-
backend.IntegrationFactory
|
|
29
27
|
);
|
|
30
28
|
|
|
31
29
|
return {
|
|
@@ -2,10 +2,19 @@ const path = require('path');
|
|
|
2
2
|
const fs = require('fs');
|
|
3
3
|
const { AWSDiscovery } = require('./aws-discovery');
|
|
4
4
|
|
|
5
|
-
const shouldRunDiscovery = (AppDefinition) =>
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
const shouldRunDiscovery = (AppDefinition) => {
|
|
6
|
+
// Check if we're running in offline mode (local development)
|
|
7
|
+
// Set IS_OFFLINE=true in your .env file for local development
|
|
8
|
+
if (process.env.IS_OFFLINE === 'true') {
|
|
9
|
+
console.log('⏭️ Skipping AWS discovery for local development (IS_OFFLINE=true)');
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// Only run discovery if VPC, KMS encryption, or SSM is enabled
|
|
14
|
+
return AppDefinition.vpc?.enable === true ||
|
|
15
|
+
AppDefinition.encryption?.fieldLevelEncryptionMethod === 'kms' ||
|
|
16
|
+
AppDefinition.ssm?.enable === true;
|
|
17
|
+
};
|
|
9
18
|
|
|
10
19
|
const getAppEnvironmentVars = (AppDefinition) => {
|
|
11
20
|
const envVars = {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@friggframework/devtools",
|
|
3
3
|
"prettier": "@friggframework/prettier-config",
|
|
4
|
-
"version": "2.0.0--canary.
|
|
4
|
+
"version": "2.0.0--canary.395.eb0264e.0",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@aws-sdk/client-ec2": "^3.835.0",
|
|
7
7
|
"@aws-sdk/client-kms": "^3.835.0",
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
"@babel/eslint-parser": "^7.18.9",
|
|
10
10
|
"@babel/parser": "^7.25.3",
|
|
11
11
|
"@babel/traverse": "^7.25.3",
|
|
12
|
-
"@friggframework/schemas": "2.0.0--canary.
|
|
13
|
-
"@friggframework/test": "2.0.0--canary.
|
|
12
|
+
"@friggframework/schemas": "2.0.0--canary.395.eb0264e.0",
|
|
13
|
+
"@friggframework/test": "2.0.0--canary.395.eb0264e.0",
|
|
14
14
|
"@hapi/boom": "^10.0.1",
|
|
15
15
|
"@inquirer/prompts": "^5.3.8",
|
|
16
16
|
"axios": "^1.7.2",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"serverless-http": "^2.7.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@friggframework/eslint-config": "2.0.0--canary.
|
|
36
|
-
"@friggframework/prettier-config": "2.0.0--canary.
|
|
35
|
+
"@friggframework/eslint-config": "2.0.0--canary.395.eb0264e.0",
|
|
36
|
+
"@friggframework/prettier-config": "2.0.0--canary.395.eb0264e.0",
|
|
37
37
|
"aws-sdk-client-mock": "^4.1.0",
|
|
38
38
|
"aws-sdk-client-mock-jest": "^4.1.0",
|
|
39
39
|
"jest": "^30.1.3",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"publishConfig": {
|
|
69
69
|
"access": "public"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "eb0264e7fb4d26ee5fa81fb693905775609e5671"
|
|
72
72
|
}
|
package/test/index.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
const {testDefinitionRequiredAuthMethods} = require('./auther-definition-method-tester');
|
|
2
|
-
const {createMockIntegration, createMockApiObject} = require('./mock-integration');
|
|
3
|
-
const { testAutherDefinition } = require('./auther-definition-tester');
|
|
1
|
+
const { testDefinitionRequiredAuthMethods } = require('./auther-definition-method-tester');
|
|
2
|
+
const { createMockIntegration, createMockApiObject } = require('./mock-integration');
|
|
4
3
|
|
|
5
4
|
|
|
6
5
|
module.exports = {
|
|
7
6
|
createMockIntegration,
|
|
8
7
|
createMockApiObject,
|
|
9
8
|
testDefinitionRequiredAuthMethods,
|
|
10
|
-
testAutherDefinition,
|
|
11
9
|
};
|
package/test/mock-integration.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
const {
|
|
2
|
-
Auther,
|
|
3
|
-
Credential,
|
|
4
|
-
Entity,
|
|
5
|
-
IntegrationFactory,
|
|
6
2
|
createObjectId,
|
|
7
3
|
} = require('@friggframework/core');
|
|
8
4
|
|
|
@@ -11,7 +7,6 @@ async function createMockIntegration(
|
|
|
11
7
|
userId = null,
|
|
12
8
|
config = { type: IntegrationClass.Definition.name }
|
|
13
9
|
) {
|
|
14
|
-
const integrationFactory = new IntegrationFactory([IntegrationClass]);
|
|
15
10
|
userId = userId || createObjectId();
|
|
16
11
|
|
|
17
12
|
const insertOptions = {
|
|
@@ -24,10 +19,8 @@ async function createMockIntegration(
|
|
|
24
19
|
const entities = [];
|
|
25
20
|
for (const moduleName in IntegrationClass.modules) {
|
|
26
21
|
const ModuleDef = IntegrationClass.Definition.modules[moduleName];
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
userId: userId,
|
|
30
|
-
});
|
|
22
|
+
// todo: create module using the new architecture
|
|
23
|
+
const module = {}
|
|
31
24
|
const credential = await module.CredentialModel.findOneAndUpdate(
|
|
32
25
|
user,
|
|
33
26
|
{ $set: user },
|
|
@@ -51,11 +44,8 @@ async function createMockIntegration(
|
|
|
51
44
|
);
|
|
52
45
|
}
|
|
53
46
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
userId,
|
|
57
|
-
config
|
|
58
|
-
);
|
|
47
|
+
// todo: create integration using the new architecture
|
|
48
|
+
const integration = {}
|
|
59
49
|
|
|
60
50
|
integration.id = integration.record._id;
|
|
61
51
|
|
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
# AWS Discovery Troubleshooting Guide
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
AWS Discovery automatically finds your default AWS resources (VPC, subnets, security groups, KMS keys) during the build process. This eliminates the need to manually specify resource IDs in your configuration.
|
|
6
|
-
|
|
7
|
-
## When AWS Discovery Runs
|
|
8
|
-
|
|
9
|
-
AWS Discovery runs automatically during `frigg build` and `frigg deploy` when your AppDefinition includes:
|
|
10
|
-
|
|
11
|
-
- `vpc.enable: true` - VPC support
|
|
12
|
-
- `encryption.fieldLevelEncryptionMethod: 'kms'` - KMS encryption
|
|
13
|
-
- `ssm.enable: true` - SSM Parameter Store
|
|
14
|
-
|
|
15
|
-
## Fail-Fast Behavior
|
|
16
|
-
|
|
17
|
-
⚠️ **Important:** If you enable these features, discovery **must succeed**. The build will fail if:
|
|
18
|
-
- AWS credentials are missing or invalid
|
|
19
|
-
- Required AWS permissions are not granted
|
|
20
|
-
- No VPC/subnets exist in your region
|
|
21
|
-
- Discovery times out or encounters errors
|
|
22
|
-
|
|
23
|
-
This prevents deployments with incorrect or missing AWS resources, which could cause security issues or deployment failures.
|
|
24
|
-
|
|
25
|
-
## Common Issues
|
|
26
|
-
|
|
27
|
-
### 1. "Variables resolution errored" - Environment Variables Not Found
|
|
28
|
-
|
|
29
|
-
**Error:**
|
|
30
|
-
```
|
|
31
|
-
Cannot resolve variable at "provider.vpc.securityGroupIds.0": Value not found at "env" source
|
|
32
|
-
Cannot resolve variable at "provider.vpc.subnetIds.0": Value not found at "env" source
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
**Cause:** AWS discovery didn't run or failed to set environment variables.
|
|
36
|
-
|
|
37
|
-
**Solutions:**
|
|
38
|
-
|
|
39
|
-
#### Option A: Run Discovery Manually
|
|
40
|
-
```bash
|
|
41
|
-
# Run discovery before building
|
|
42
|
-
node node_modules/@friggframework/devtools/infrastructure/run-discovery.js
|
|
43
|
-
|
|
44
|
-
# Then build
|
|
45
|
-
npx frigg build
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
#### Option B: Check Prerequisites
|
|
49
|
-
1. **AWS Credentials:** Ensure AWS CLI is configured
|
|
50
|
-
```bash
|
|
51
|
-
aws configure list
|
|
52
|
-
aws sts get-caller-identity
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
2. **IAM Permissions:** User needs discovery permissions (see [AWS-IAM-CREDENTIAL-NEEDS.md](./AWS-IAM-CREDENTIAL-NEEDS.md))
|
|
56
|
-
- `sts:GetCallerIdentity`
|
|
57
|
-
- `ec2:DescribeVpcs`
|
|
58
|
-
- `ec2:DescribeSubnets`
|
|
59
|
-
- `ec2:DescribeSecurityGroups`
|
|
60
|
-
- `ec2:DescribeRouteTables`
|
|
61
|
-
- `kms:ListKeys`
|
|
62
|
-
- `kms:DescribeKey`
|
|
63
|
-
|
|
64
|
-
3. **Default VPC:** Ensure you have a VPC in your AWS region
|
|
65
|
-
```bash
|
|
66
|
-
aws ec2 describe-vpcs --region us-east-1
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
### 2. AWS SDK Not Installed
|
|
70
|
-
|
|
71
|
-
**Error:**
|
|
72
|
-
```bash
|
|
73
|
-
🚨 AWS SDK not installed!
|
|
74
|
-
Cannot find module '@aws-sdk/client-ec2'
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
**Cause:** AWS SDK dependencies are only installed when needed to keep bundle size minimal.
|
|
78
|
-
|
|
79
|
-
**Solution:**
|
|
80
|
-
```bash
|
|
81
|
-
# Install required AWS SDK packages
|
|
82
|
-
npm install @aws-sdk/client-ec2 @aws-sdk/client-kms @aws-sdk/client-sts
|
|
83
|
-
|
|
84
|
-
# Then run discovery
|
|
85
|
-
npx frigg build
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
**Note:** AWS SDK is optional - only install if you use VPC/KMS/SSM features.
|
|
89
|
-
|
|
90
|
-
### 3. No Default VPC Found
|
|
91
|
-
|
|
92
|
-
**Error:**
|
|
93
|
-
```
|
|
94
|
-
No VPC found in the account
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
**Cause:** Your AWS account doesn't have a default VPC or any VPCs in the current region.
|
|
98
|
-
|
|
99
|
-
**Solutions:**
|
|
100
|
-
|
|
101
|
-
#### Option A: Create Default VPC
|
|
102
|
-
```bash
|
|
103
|
-
aws ec2 create-default-vpc --region us-east-1
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
#### Option B: Disable VPC in AppDefinition
|
|
107
|
-
```javascript
|
|
108
|
-
// backend/index.js
|
|
109
|
-
const appDefinition = {
|
|
110
|
-
// ... other config
|
|
111
|
-
vpc: {
|
|
112
|
-
enable: false // Disable VPC support
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
### 4. Permission Denied During Discovery
|
|
118
|
-
|
|
119
|
-
**Error:**
|
|
120
|
-
```
|
|
121
|
-
User: arn:aws:iam::123456789012:user/my-user is not authorized to perform: ec2:DescribeVpcs
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
**Cause:** IAM user lacks discovery permissions.
|
|
125
|
-
|
|
126
|
-
**Solution:**
|
|
127
|
-
1. Update IAM policy with discovery permissions
|
|
128
|
-
2. Or generate a custom IAM stack:
|
|
129
|
-
```bash
|
|
130
|
-
npx frigg generate-iam
|
|
131
|
-
aws cloudformation deploy --template-file backend/infrastructure/frigg-deployment-iam.yaml --stack-name frigg-deployment-iam --capabilities CAPABILITY_NAMED_IAM
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
### 5. Region Configuration Issues
|
|
135
|
-
|
|
136
|
-
**Error:**
|
|
137
|
-
```
|
|
138
|
-
No subnets found in VPC vpc-123456789
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
**Cause:** AWS discovery is looking in the wrong region or region has no subnets.
|
|
142
|
-
|
|
143
|
-
**Solutions:**
|
|
144
|
-
|
|
145
|
-
#### Option A: Set AWS Region
|
|
146
|
-
```bash
|
|
147
|
-
export AWS_REGION=us-east-1
|
|
148
|
-
npx frigg build
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
#### Option B: Check Current Region
|
|
152
|
-
```bash
|
|
153
|
-
aws configure get region
|
|
154
|
-
aws ec2 describe-availability-zones --query 'AvailabilityZones[0].RegionName'
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
## Manual Override
|
|
158
|
-
|
|
159
|
-
If AWS discovery continues to fail, you can manually set environment variables:
|
|
160
|
-
|
|
161
|
-
```bash
|
|
162
|
-
# Find your actual resource IDs
|
|
163
|
-
aws ec2 describe-vpcs --query 'Vpcs[0].VpcId' --output text
|
|
164
|
-
aws ec2 describe-subnets --filters "Name=vpc-id,Values=vpc-12345678" --query 'Subnets[0:2].SubnetId' --output text
|
|
165
|
-
|
|
166
|
-
# Set before building
|
|
167
|
-
export AWS_DISCOVERY_VPC_ID=vpc-12345678
|
|
168
|
-
export AWS_DISCOVERY_SECURITY_GROUP_ID=sg-12345678
|
|
169
|
-
export AWS_DISCOVERY_SUBNET_ID_1=subnet-12345678
|
|
170
|
-
export AWS_DISCOVERY_SUBNET_ID_2=subnet-87654321
|
|
171
|
-
export AWS_DISCOVERY_PUBLIC_SUBNET_ID=subnet-abcdef12
|
|
172
|
-
export AWS_DISCOVERY_ROUTE_TABLE_ID=rtb-12345678
|
|
173
|
-
export AWS_DISCOVERY_KMS_KEY_ID=arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
|
|
174
|
-
|
|
175
|
-
npx frigg build
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
**⚠️ Important:** Use real AWS resource IDs, not placeholder values. Fake IDs will cause deployment failures.
|
|
179
|
-
|
|
180
|
-
## Debugging Discovery
|
|
181
|
-
|
|
182
|
-
### Enable Verbose Logging
|
|
183
|
-
```bash
|
|
184
|
-
npx frigg build --verbose
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
### Test Discovery Standalone
|
|
188
|
-
```bash
|
|
189
|
-
# Test discovery without building
|
|
190
|
-
node node_modules/@friggframework/devtools/infrastructure/run-discovery.js
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
### Check Environment Variables
|
|
194
|
-
```bash
|
|
195
|
-
# After running discovery
|
|
196
|
-
printenv | grep AWS_DISCOVERY
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
## Recovery Steps
|
|
200
|
-
|
|
201
|
-
If you're stuck, try this recovery process:
|
|
202
|
-
|
|
203
|
-
1. **Verify AWS Setup**
|
|
204
|
-
```bash
|
|
205
|
-
aws sts get-caller-identity
|
|
206
|
-
aws ec2 describe-vpcs --region us-east-1
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
2. **Check App Definition**
|
|
210
|
-
```bash
|
|
211
|
-
# Ensure your backend/index.js exports Definition correctly
|
|
212
|
-
node -e "console.log(require('./backend/index.js').Definition)"
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
3. **Run Discovery Manually**
|
|
216
|
-
```bash
|
|
217
|
-
node node_modules/@friggframework/devtools/infrastructure/run-discovery.js
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
4. **Disable Features Temporarily**
|
|
221
|
-
```javascript
|
|
222
|
-
// backend/index.js - temporarily disable problematic features
|
|
223
|
-
const appDefinition = {
|
|
224
|
-
vpc: { enable: false },
|
|
225
|
-
encryption: { fieldLevelEncryptionMethod: 'aes' },
|
|
226
|
-
ssm: { enable: false }
|
|
227
|
-
};
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
5. **Build and Test**
|
|
231
|
-
```bash
|
|
232
|
-
npx frigg build
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
## Getting Help
|
|
236
|
-
|
|
237
|
-
If discovery continues to fail:
|
|
238
|
-
|
|
239
|
-
1. **Check logs** for specific error messages
|
|
240
|
-
2. **Verify IAM permissions** using the generated IAM stack
|
|
241
|
-
3. **Test AWS CLI access** in your target region
|
|
242
|
-
4. **Review AppDefinition** for correct feature flags
|
|
243
|
-
5. **Try fallback values** as a temporary workaround
|
|
244
|
-
|
|
245
|
-
The discovery system is designed to be resilient, but AWS environment differences can cause issues. Most problems are related to IAM permissions or missing AWS resources in the target region.
|