@friggframework/devtools 2.0.0--canary.517.837ee90.0 → 2.0.0--canary.517.0ff3ee0.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.
@@ -70,10 +70,10 @@ class AdminScriptBuilder extends InfrastructureBuilder {
70
70
  this.createAdminScriptQueue(result);
71
71
 
72
72
  // Create Lambda function for script execution
73
- this.createScriptExecutorFunction(result, usePrismaLayer);
73
+ this.createScriptExecutorFunction(appDefinition, result, usePrismaLayer);
74
74
 
75
75
  // Create API routes for script management
76
- this.createAdminScriptRoutes(result, usePrismaLayer);
76
+ this.createAdminScriptRoutes(appDefinition, result, usePrismaLayer);
77
77
 
78
78
  // Phase 2: Create EventBridge Scheduler resources
79
79
  if (adminConfig.enableScheduling) {
@@ -125,10 +125,11 @@ class AdminScriptBuilder extends InfrastructureBuilder {
125
125
  console.log(' ✓ Created AdminScriptQueue');
126
126
  }
127
127
 
128
- createScriptExecutorFunction(result, usePrismaLayer) {
128
+ createScriptExecutorFunction(appDefinition, result, usePrismaLayer) {
129
129
  result.functions.adminScriptExecutor = {
130
130
  handler: 'node_modules/@friggframework/admin-scripts/src/infrastructure/script-executor-handler.handler',
131
131
  skipEsbuild: true,
132
+ package: this.skipEsbuildPackageConfig(appDefinition, usePrismaLayer),
132
133
  ...(usePrismaLayer && { layers: [{ Ref: 'PrismaLambdaLayer' }] }),
133
134
  timeout: 900, // 15 minutes max
134
135
  memorySize: 1024,
@@ -144,10 +145,11 @@ class AdminScriptBuilder extends InfrastructureBuilder {
144
145
  console.log(' ✓ Created adminScriptExecutor function');
145
146
  }
146
147
 
147
- createAdminScriptRoutes(result, usePrismaLayer) {
148
+ createAdminScriptRoutes(appDefinition, result, usePrismaLayer) {
148
149
  result.functions.adminScriptRouter = {
149
150
  handler: 'node_modules/@friggframework/admin-scripts/src/infrastructure/admin-script-router.handler',
150
151
  skipEsbuild: true,
152
+ package: this.skipEsbuildPackageConfig(appDefinition, usePrismaLayer),
151
153
  ...(usePrismaLayer && { layers: [{ Ref: 'PrismaLambdaLayer' }] }),
152
154
  timeout: 30,
153
155
  events: [
@@ -177,6 +179,61 @@ class AdminScriptBuilder extends InfrastructureBuilder {
177
179
  console.log(' ✓ Created adminScriptRouter function');
178
180
  }
179
181
 
182
+ // Without this, the skipEsbuild functions package the whole node_modules
183
+ // closure (aws-sdk, Prisma, dev deps) and blow past Lambda's 250 MB limit.
184
+ // Mirrors the exclusions the framework's other node_modules handlers use.
185
+ skipEsbuildPackageConfig(appDefinition, usePrismaLayer) {
186
+ const tlsCAFile = appDefinition?.database?.documentDB?.tlsCAFile;
187
+ return {
188
+ include: [
189
+ // Handlers connect to the DB, so ship the DocumentDB CA cert.
190
+ ...(tlsCAFile ? [tlsCAFile.replace(/^\.\//, '')] : []),
191
+ ],
192
+ exclude: [
193
+ 'node_modules/aws-sdk/**',
194
+ 'node_modules/@aws-sdk/**',
195
+ ...(usePrismaLayer
196
+ ? [
197
+ 'node_modules/@prisma/**',
198
+ 'node_modules/.prisma/**',
199
+ 'node_modules/prisma/**',
200
+ 'node_modules/@friggframework/core/generated/**',
201
+ ]
202
+ : []),
203
+ 'node_modules/**/node_modules/**',
204
+ 'node_modules/@friggframework/test/**',
205
+ 'node_modules/@friggframework/eslint-config/**',
206
+ 'node_modules/@friggframework/prettier-config/**',
207
+ 'node_modules/jest/**',
208
+ 'node_modules/prettier/**',
209
+ 'node_modules/eslint/**',
210
+ 'node_modules/esbuild/**',
211
+ 'node_modules/@esbuild/**',
212
+ 'node_modules/typescript/**',
213
+ 'node_modules/webpack/**',
214
+ 'node_modules/osls/**',
215
+ 'node_modules/serverless-esbuild/**',
216
+ 'node_modules/serverless-jetpack/**',
217
+ 'node_modules/serverless-offline/**',
218
+ 'node_modules/serverless-offline-sqs/**',
219
+ 'node_modules/serverless-dotenv-plugin/**',
220
+ 'node_modules/serverless-kms-grants/**',
221
+ // Never deploy secrets or the lockfile.
222
+ '.env',
223
+ '.env.*',
224
+ '**/.env',
225
+ '**/.env.*',
226
+ '.frigg-credentials.json',
227
+ 'package-lock.json',
228
+ 'test/**',
229
+ 'layers/**',
230
+ 'coverage/**',
231
+ '**/*.test.js',
232
+ '**/*.spec.js',
233
+ ],
234
+ };
235
+ }
236
+
180
237
  createSchedulerResources(appDefinition, result) {
181
238
  // Constructed ARN, not Fn::GetAtt: a GetAtt edge to the executor closes a
182
239
  // CloudFormation circular dependency via the shared Lambda execution role.
@@ -220,12 +277,14 @@ class AdminScriptBuilder extends InfrastructureBuilder {
220
277
  },
221
278
  };
222
279
 
223
- result.environment.SCHEDULER_PROVIDER = 'aws';
224
-
225
- // Router-scoped, not shared provider env: broadcasting these resource
226
- // references to every function creates CloudFormation circular deps.
280
+ // Router-scoped, not shared provider env. Two reasons: broadcasting the
281
+ // resource references to every function creates CloudFormation circular
282
+ // deps; and SCHEDULER_PROVIDER='aws' is only valid for the admin-script
283
+ // adapter (the router's sole consumer) — core's scheduler factory, used
284
+ // by integration Lambdas, rejects 'aws', so it must not leak app-wide.
227
285
  result.functions.adminScriptRouter.environment = {
228
286
  ...(result.functions.adminScriptRouter.environment || {}),
287
+ SCHEDULER_PROVIDER: 'aws',
229
288
  SCHEDULER_ROLE_ARN: {
230
289
  'Fn::GetAtt': ['AdminScriptSchedulerRole', 'Arn'],
231
290
  },
@@ -257,6 +257,29 @@ describe('AdminScriptBuilder', () => {
257
257
  expect(result.functions.adminScriptExecutor.memorySize).toBe(1024);
258
258
  });
259
259
 
260
+ it('should exclude aws-sdk/Prisma from the skipEsbuild function packages', async () => {
261
+ const appDefinition = {
262
+ adminScripts: [{ Definition: { name: 'test-script' } }],
263
+ };
264
+
265
+ const result = await adminScriptBuilder.build(appDefinition, {});
266
+
267
+ // Regression: without a package config the skipEsbuild functions
268
+ // package the whole node_modules and exceed Lambda's 250 MB limit.
269
+ for (const fn of [
270
+ result.functions.adminScriptExecutor,
271
+ result.functions.adminScriptRouter,
272
+ ]) {
273
+ expect(fn.package.exclude).toEqual(
274
+ expect.arrayContaining([
275
+ 'node_modules/aws-sdk/**',
276
+ 'node_modules/@aws-sdk/**',
277
+ 'node_modules/@prisma/**',
278
+ ])
279
+ );
280
+ }
281
+ });
282
+
260
283
  it('should attach Prisma layer to adminScriptExecutor', async () => {
261
284
  const appDefinition = {
262
285
  adminScripts: [
@@ -366,12 +389,13 @@ describe('AdminScriptBuilder', () => {
366
389
  expect(result.resources.AdminScriptScheduleGroup).toBeDefined();
367
390
  expect(result.resources.AdminScriptScheduleGroup.Type).toBe('AWS::Scheduler::ScheduleGroup');
368
391
 
369
- // SCHEDULER_PROVIDER is a constant and stays on the shared env.
370
- expect(result.environment.SCHEDULER_PROVIDER).toBe('aws');
371
-
372
- // Resource-reference env vars are scoped to the router function (not
373
- // the shared provider env) to avoid CloudFormation circular deps.
392
+ // Scheduler env vars are scoped to the router function (not the
393
+ // shared provider env): resource refs would create CloudFormation
394
+ // circular deps, and SCHEDULER_PROVIDER='aws' would break core's
395
+ // scheduler factory (rejects 'aws') for every other Lambda.
374
396
  const routerEnv = result.functions.adminScriptRouter.environment;
397
+ expect(routerEnv.SCHEDULER_PROVIDER).toBe('aws');
398
+ expect(result.environment.SCHEDULER_PROVIDER).toBeUndefined();
375
399
  expect(routerEnv.SCHEDULER_ROLE_ARN).toEqual({
376
400
  'Fn::GetAtt': ['AdminScriptSchedulerRole', 'Arn'],
377
401
  });
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.517.837ee90.0",
4
+ "version": "2.0.0--canary.517.0ff3ee0.0",
5
5
  "bin": {
6
6
  "frigg": "./frigg-cli/index.js"
7
7
  },
@@ -25,9 +25,9 @@
25
25
  "@babel/eslint-parser": "^7.18.9",
26
26
  "@babel/parser": "^7.25.3",
27
27
  "@babel/traverse": "^7.25.3",
28
- "@friggframework/core": "2.0.0--canary.517.837ee90.0",
29
- "@friggframework/schemas": "2.0.0--canary.517.837ee90.0",
30
- "@friggframework/test": "2.0.0--canary.517.837ee90.0",
28
+ "@friggframework/core": "2.0.0--canary.517.0ff3ee0.0",
29
+ "@friggframework/schemas": "2.0.0--canary.517.0ff3ee0.0",
30
+ "@friggframework/test": "2.0.0--canary.517.0ff3ee0.0",
31
31
  "@hapi/boom": "^10.0.1",
32
32
  "@inquirer/prompts": "^5.3.8",
33
33
  "axios": "^1.18.0",
@@ -55,8 +55,8 @@
55
55
  "validate-npm-package-name": "^5.0.0"
56
56
  },
57
57
  "devDependencies": {
58
- "@friggframework/eslint-config": "2.0.0--canary.517.837ee90.0",
59
- "@friggframework/prettier-config": "2.0.0--canary.517.837ee90.0",
58
+ "@friggframework/eslint-config": "2.0.0--canary.517.0ff3ee0.0",
59
+ "@friggframework/prettier-config": "2.0.0--canary.517.0ff3ee0.0",
60
60
  "aws-sdk-client-mock": "^4.1.0",
61
61
  "aws-sdk-client-mock-jest": "^4.1.0",
62
62
  "jest": "^30.1.3",
@@ -88,5 +88,5 @@
88
88
  "publishConfig": {
89
89
  "access": "public"
90
90
  },
91
- "gitHead": "837ee90500d8b87fbe9d904c1b64d0f1ce8b8f7a"
91
+ "gitHead": "0ff3ee04ee7a6effd37adbd756be25eae7dc1fc7"
92
92
  }