@friggframework/devtools 2.0.0--canary.517.9750290.0 → 2.0.0--canary.517.8e1c21c.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.
@@ -129,6 +129,7 @@ class AdminScriptBuilder extends InfrastructureBuilder {
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(usePrismaLayer),
132
133
  ...(usePrismaLayer && { layers: [{ Ref: 'PrismaLambdaLayer' }] }),
133
134
  timeout: 900, // 15 minutes max
134
135
  memorySize: 1024,
@@ -148,6 +149,7 @@ class AdminScriptBuilder extends InfrastructureBuilder {
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(usePrismaLayer),
151
153
  ...(usePrismaLayer && { layers: [{ Ref: 'PrismaLambdaLayer' }] }),
152
154
  timeout: 30,
153
155
  events: [
@@ -177,12 +179,55 @@ 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
+ skipEsbuildPackageConfig(usePrismaLayer) {
185
+ return {
186
+ exclude: [
187
+ 'node_modules/aws-sdk/**',
188
+ 'node_modules/@aws-sdk/**',
189
+ ...(usePrismaLayer
190
+ ? [
191
+ 'node_modules/@prisma/**',
192
+ 'node_modules/.prisma/**',
193
+ 'node_modules/prisma/**',
194
+ 'node_modules/@friggframework/core/generated/**',
195
+ ]
196
+ : []),
197
+ 'node_modules/**/node_modules/**',
198
+ 'node_modules/@friggframework/test/**',
199
+ 'node_modules/@friggframework/eslint-config/**',
200
+ 'node_modules/@friggframework/prettier-config/**',
201
+ 'node_modules/jest/**',
202
+ 'node_modules/prettier/**',
203
+ 'node_modules/eslint/**',
204
+ 'node_modules/esbuild/**',
205
+ 'node_modules/@esbuild/**',
206
+ 'node_modules/typescript/**',
207
+ 'node_modules/webpack/**',
208
+ 'node_modules/osls/**',
209
+ 'node_modules/serverless-esbuild/**',
210
+ 'node_modules/serverless-jetpack/**',
211
+ 'node_modules/serverless-offline/**',
212
+ 'node_modules/serverless-offline-sqs/**',
213
+ 'node_modules/serverless-dotenv-plugin/**',
214
+ 'node_modules/serverless-kms-grants/**',
215
+ '.env',
216
+ '.env.*',
217
+ '**/.env',
218
+ '**/.env.*',
219
+ 'test/**',
220
+ 'layers/**',
221
+ 'coverage/**',
222
+ '**/*.test.js',
223
+ '**/*.spec.js',
224
+ ],
225
+ };
226
+ }
227
+
180
228
  createSchedulerResources(appDefinition, result) {
181
- // Reference the executor by a constructed ARN (Fn::Sub) rather than
182
- // Fn::GetAtt. GetAtt creates a CloudFormation dependency edge, and an
183
- // edge from the scheduler role to the executor closed a cycle through the
184
- // shared Lambda execution role (role → executor → IamRoleLambdaExecution
185
- // → PassRole → role). The name is deterministic, so a Sub is safe.
229
+ // Constructed ARN, not Fn::GetAtt: a GetAtt edge to the executor closes a
230
+ // CloudFormation circular dependency via the shared Lambda execution role.
186
231
  const executorArn = {
187
232
  'Fn::Sub':
188
233
  'arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:${self:service}-${self:provider.stage}-adminScriptExecutor',
@@ -223,18 +268,10 @@ class AdminScriptBuilder extends InfrastructureBuilder {
223
268
  },
224
269
  };
225
270
 
226
- // SCHEDULER_PROVIDER is a constant, so it's safe on the shared provider
227
- // environment inherited by every function.
228
271
  result.environment.SCHEDULER_PROVIDER = 'aws';
229
272
 
230
- // The remaining vars carry resource references and are consumed ONLY by
231
- // the router (it builds the AWS scheduler adapter in the schedule
232
- // handlers). Scope them to the router function rather than the shared
233
- // provider environment: broadcasting the executor's own ARN into every
234
- // function's env made the executor depend on itself, and the role/group
235
- // refs made every function depend on the scheduler role — both closed
236
- // CloudFormation circular dependencies on deploy. Names must match
237
- // admin-script-router.js exactly.
273
+ // Router-scoped, not shared provider env: broadcasting these resource
274
+ // references to every function creates CloudFormation circular deps.
238
275
  result.functions.adminScriptRouter.environment = {
239
276
  ...(result.functions.adminScriptRouter.environment || {}),
240
277
  SCHEDULER_ROLE_ARN: {
@@ -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: [
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.9750290.0",
4
+ "version": "2.0.0--canary.517.8e1c21c.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.9750290.0",
29
- "@friggframework/schemas": "2.0.0--canary.517.9750290.0",
30
- "@friggframework/test": "2.0.0--canary.517.9750290.0",
28
+ "@friggframework/core": "2.0.0--canary.517.8e1c21c.0",
29
+ "@friggframework/schemas": "2.0.0--canary.517.8e1c21c.0",
30
+ "@friggframework/test": "2.0.0--canary.517.8e1c21c.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.9750290.0",
59
- "@friggframework/prettier-config": "2.0.0--canary.517.9750290.0",
58
+ "@friggframework/eslint-config": "2.0.0--canary.517.8e1c21c.0",
59
+ "@friggframework/prettier-config": "2.0.0--canary.517.8e1c21c.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": "9750290bdb331b5f2d1304d7e64adc3c480f1fb7"
91
+ "gitHead": "8e1c21cfab6708ab3456516f2e3520eeb12e8c14"
92
92
  }