@friggframework/devtools 2.0.0--canary.414.61d0ef1.0 → 2.0.0--canary.414.e55499d.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.
@@ -4,41 +4,107 @@ const fs = require('fs');
4
4
 
5
5
  async function deployCommand(options) {
6
6
  console.log('Deploying the serverless application...');
7
-
7
+
8
+ // Collect validated environment variables
9
+ let integrationEnvironmentVariables = { ...process.env }; // Start with all, then filter
10
+
8
11
  // Try to load and validate environment from appDefinition
9
12
  const appDefPath = path.join(process.cwd(), 'index.js');
10
13
  if (fs.existsSync(appDefPath)) {
11
14
  try {
12
15
  const { Definition } = require(appDefPath);
13
-
16
+
14
17
  if (Definition.environment) {
15
- console.log('🔧 Loading environment configuration from appDefinition...');
16
- const envVars = Object.keys(Definition.environment).filter(key => Definition.environment[key] === true);
17
- console.log(` Found ${envVars.length} environment variables: ${envVars.join(', ')}`);
18
-
18
+ console.log(
19
+ '🔧 Loading environment configuration from appDefinition...'
20
+ );
21
+ const envVars = Object.keys(Definition.environment).filter(
22
+ (key) => Definition.environment[key] === true
23
+ );
24
+ console.log(
25
+ ` Found ${
26
+ envVars.length
27
+ } environment variables: ${envVars.join(', ')}`
28
+ );
29
+
19
30
  // Try to use the env-validator if available
20
31
  try {
21
- const { validateEnvironmentVariables } = require('@friggframework/devtools/infrastructure/env-validator');
32
+ const {
33
+ validateEnvironmentVariables,
34
+ } = require('@friggframework/devtools/infrastructure/env-validator');
22
35
  const validation = validateEnvironmentVariables(Definition);
23
-
24
- if (validation.missing.length > 0 && !options.skipEnvValidation) {
25
- console.warn('⚠️ Warning: Missing environment variables detected');
26
- console.warn(' Run with --skip-env-validation to bypass this check');
36
+
37
+ if (
38
+ validation.missing.length > 0 &&
39
+ !options.skipEnvValidation
40
+ ) {
41
+ console.warn(
42
+ `⚠️ Warning: Missing ${validation.missing.length} environment variables: ${validation.missing.join(', ')}`
43
+ );
44
+ console.warn(
45
+ ' These variables are optional and deployment will continue'
46
+ );
47
+ console.warn(
48
+ ' Run with --skip-env-validation to bypass this check'
49
+ );
27
50
  }
51
+
52
+ // Pass essential system variables + app-defined environment variables
53
+ integrationEnvironmentVariables = {
54
+ // Essential system variables needed to run serverless
55
+ PATH: process.env.PATH,
56
+ HOME: process.env.HOME,
57
+ USER: process.env.USER,
58
+
59
+ // App-defined environment variables
60
+ ...Object.fromEntries(
61
+ envVars
62
+ .map((key) => [key, process.env[key]])
63
+ .filter(([_, value]) => value !== undefined)
64
+ )
65
+ };
28
66
  } catch (validatorError) {
29
67
  // Validator not available in current version, just warn
30
- const missing = envVars.filter(v => !process.env[v]);
68
+ const missing = envVars.filter((v) => !process.env[v]);
31
69
  if (missing.length > 0) {
32
- console.warn(`⚠️ Warning: Missing environment variables: ${missing.join(', ')}`);
33
- console.warn(' These should be set in your CI/CD environment or .env file');
70
+ console.warn(
71
+ `⚠️ Warning: Missing ${missing.length} environment variables: ${missing.join(
72
+ ', '
73
+ )}`
74
+ );
75
+ console.warn(
76
+ ' These variables are optional and deployment will continue'
77
+ );
78
+ console.warn(
79
+ ' Set them in your CI/CD environment or .env file if needed'
80
+ );
34
81
  }
82
+
83
+ // Pass essential system variables + app-defined environment variables
84
+ integrationEnvironmentVariables = {
85
+ // Essential system variables needed to run serverless
86
+ PATH: process.env.PATH,
87
+ HOME: process.env.HOME,
88
+ USER: process.env.USER,
89
+
90
+ // App-defined environment variables
91
+ ...Object.fromEntries(
92
+ envVars
93
+ .map((key) => [key, process.env[key]])
94
+ .filter(([_, value]) => value !== undefined)
95
+ )
96
+ };
35
97
  }
36
98
  }
37
99
  } catch (error) {
38
- console.warn('Could not load appDefinition environment config:', error.message);
100
+ console.warn(
101
+ 'Could not load appDefinition environment config:',
102
+ error.message
103
+ );
104
+ // Keep all env vars if we can't validate
39
105
  }
40
106
  }
41
-
107
+
42
108
  // AWS discovery is now handled directly in serverless-template.js
43
109
  console.log('🚀 Deploying serverless application...');
44
110
  const backendPath = path.resolve(process.cwd());
@@ -49,12 +115,13 @@ async function deployCommand(options) {
49
115
  '--config',
50
116
  infrastructurePath,
51
117
  '--stage',
52
- options.stage
118
+ options.stage,
53
119
  ];
54
120
 
55
121
  const childProcess = spawn(command, serverlessArgs, {
56
122
  cwd: backendPath,
57
123
  stdio: 'inherit',
124
+ env: integrationEnvironmentVariables, // Only pass validated environment variables
58
125
  });
59
126
 
60
127
  childProcess.on('error', (error) => {
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.414.61d0ef1.0",
4
+ "version": "2.0.0--canary.414.e55499d.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.414.61d0ef1.0",
13
- "@friggframework/test": "2.0.0--canary.414.61d0ef1.0",
12
+ "@friggframework/schemas": "2.0.0--canary.414.e55499d.0",
13
+ "@friggframework/test": "2.0.0--canary.414.e55499d.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.414.61d0ef1.0",
36
- "@friggframework/prettier-config": "2.0.0--canary.414.61d0ef1.0",
35
+ "@friggframework/eslint-config": "2.0.0--canary.414.e55499d.0",
36
+ "@friggframework/prettier-config": "2.0.0--canary.414.e55499d.0",
37
37
  "prettier": "^2.7.1",
38
38
  "serverless": "3.39.0",
39
39
  "serverless-dotenv-plugin": "^6.0.0",
@@ -65,5 +65,5 @@
65
65
  "publishConfig": {
66
66
  "access": "public"
67
67
  },
68
- "gitHead": "61d0ef18cc849b8d26e67221c368bde48543c0dd"
68
+ "gitHead": "e55499d6104d712aff851c67611367f89784daff"
69
69
  }