@friggframework/devtools 2.0.0--canary.731.1c0b281.0 → 2.0.0--canary.730.f2ba24a.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.
Files changed (30) hide show
  1. package/infrastructure/README.md +5 -32
  2. package/infrastructure/__tests__/management-api-gateway-routes.test.js +0 -3
  3. package/infrastructure/__tests__/postgres-config.test.js +0 -3
  4. package/infrastructure/__tests__/scaffold-default-infrastructure.test.js +0 -3
  5. package/infrastructure/__tests__/scoped-environment.test.js +0 -3
  6. package/infrastructure/__tests__/ssm-preload-node-options.test.js +0 -3
  7. package/infrastructure/__tests__/template-generation.test.js +0 -3
  8. package/infrastructure/app-definition-schema-contract.test.js +0 -5
  9. package/infrastructure/domains/admin-scripts/admin-script-builder.js +0 -2
  10. package/infrastructure/domains/admin-scripts/admin-script-builder.test.js +6 -22
  11. package/infrastructure/domains/database/migration-builder.js +2 -21
  12. package/infrastructure/domains/database/migration-builder.test.js +6 -61
  13. package/infrastructure/domains/integration/integration-builder.js +0 -2
  14. package/infrastructure/domains/integration/integration-builder.test.js +6 -22
  15. package/infrastructure/domains/shared/utilities/base-definition-factory.js +1 -13
  16. package/infrastructure/domains/shared/utilities/base-definition-factory.test.js +4 -51
  17. package/infrastructure/domains/shared/utilities/nested-node-modules.js +6 -5
  18. package/infrastructure/domains/shared/utilities/nested-node-modules.test.js +20 -26
  19. package/infrastructure/domains/shared/utilities/prisma-layer-manager.js +12 -92
  20. package/infrastructure/domains/shared/utilities/prisma-layer-manager.test.js +6 -158
  21. package/infrastructure/infrastructure-composer.js +1 -12
  22. package/infrastructure/infrastructure-composer.test.js +0 -71
  23. package/infrastructure/scripts/build-prisma-layer.js +50 -136
  24. package/infrastructure/scripts/build-prisma-layer.test.js +0 -100
  25. package/package.json +7 -7
  26. package/infrastructure/__tests__/helpers/bundled-prisma-engine-excludes.js +0 -39
  27. package/infrastructure/domains/database/migration-engines.js +0 -93
  28. package/infrastructure/domains/database/migration-engines.test.js +0 -142
  29. package/infrastructure/domains/shared/lambda-architectures.js +0 -113
  30. package/infrastructure/domains/shared/lambda-architectures.test.js +0 -164
@@ -285,50 +285,23 @@ const appDefinition = {
285
285
 
286
286
  > ℹ️ When `usePrismaLambdaLayer: false`, Prisma stays inside each bundle and the runtime automatically loads the correct binary. No extra configuration is required.
287
287
 
288
- **Keeping nested node_modules in Lambda packages:**
288
+ **Nested node_modules in Lambda packages:**
289
289
 
290
- By default every function package excludes `node_modules/**/node_modules/**`. npm only nests a package when the root copy cannot satisfy a dependant, so the exclusion makes a package resolve whatever version is hoisted, and it removes the package entirely when the root copy is a dev dependency. The first `require` of such a package then fails at Lambda init with `Runtime.ImportModuleError`.
290
+ npm nests a package under its dependant only when the root copy cannot satisfy the dependant's range. Function packages ship the dependency tree the way npm resolved it. Nested copies of `@friggframework/*`, `aws-sdk`, `@aws-sdk/*` and, when the Prisma layer is enabled, `@prisma/*` and `.prisma` are excluded: the app's single core, the Lambda runtime and the layer provide them.
291
291
 
292
- To ship the dependency tree the way npm resolved it, opt in per app:
292
+ An app can exclude every nested `node_modules` to make packages smaller:
293
293
 
294
294
  ```javascript
295
295
  const appDefinition = {
296
296
  name: 'my-app',
297
297
  lambda: {
298
- keepNestedNodeModules: true,
298
+ keepNestedNodeModules: false,
299
299
  },
300
300
  integrations: [{ Definition: { name: 'salesforce' } }],
301
301
  };
302
302
  ```
303
303
 
304
- Nested copies of `@friggframework/*`, `aws-sdk`, `@aws-sdk/*` and, when the Prisma layer is enabled, `@prisma/*` and `.prisma` stay excluded: the app's single core, the Lambda runtime and the layer provide them. Expect each function package to grow by the size of the nested directories that remain (a few MB compressed in a typical app). The default stays unchanged for apps that do not set the flag.
305
-
306
- **Lambda architecture (arm64 / Graviton):**
307
-
308
- Every function, the Prisma layer and the migration worker deploy as x86_64 unless the app definition sets `architecture`:
309
-
310
- ```javascript
311
- const appDefinition = {
312
- name: 'my-app',
313
- architecture: 'arm64', // or 'x86_64'; unset keeps today's template
314
- integrations: [{ Definition: { name: 'hubspot' } }],
315
- };
316
- ```
317
-
318
- An explicit value sets `provider.architecture` and the layer's `compatibleArchitectures`, builds the layer with that architecture's Prisma query engine, ships the migration worker with its schema engine and query engine library, and pins the migrate CLI to them through `PRISMA_SCHEMA_ENGINE_BINARY` and `PRISMA_QUERY_ENGINE_LIBRARY`. With `usePrismaLambdaLayer: false`, each function bundles only that engine. An unset key adds no field to the template.
319
-
320
- Before you flip an app to `arm64`:
321
-
322
- - It needs a `@friggframework/core` release whose generated Prisma clients include the `linux-arm64-openssl-3.0.x` engine (both schemas list it in `binaryTargets`). With an older core the layer build fails naming the core version.
323
- - The deploy host must reach Prisma's engine CDN (`binaries.prisma.sh`) at package time: the migration worker's engines for the target are fetched there, and packaging fails if either is missing.
324
- - This runs on every compose where the migration worker is enabled, and downloads only when the target's engines are missing from the app's `node_modules/@prisma/engines`.
325
- - Air-gapped or offline deploy hosts set `PRISMA_ENGINES_MIRROR` to an internal mirror of the CDN. Prisma's download honours it (`@prisma/fetch-engine` 6.19.3, `dist/chunk-LONQL55G.js`, where the download URL is built from `PRISMA_BINARIES_MIRROR || PRISMA_ENGINES_MIRROR || "https://binaries.prisma.sh"`).
326
- - The app must have `prisma` installed in its own `node_modules`, not only in a hoisted parent: the worker ships its engines from there, and packaging fails otherwise. The worker runs the app's own `prisma` CLI and pins `PRISMA_SCHEMA_ENGINE_BINARY` and `PRISMA_QUERY_ENGINE_LIBRARY` to that `@prisma/engines`, so the CLI and its engines always agree. That `prisma` must still be able to run the schema and migrations of `@friggframework/core`.
327
- - Published core carries one more query engine per generated client (about 15 MB unpacked each).
328
- - Native addons of the app itself (`sharp`, `bcrypt`, and the like) are built for the deploy host's architecture by `npm ci`, not for the target. Build them for arm64 or replace them.
329
- - During the stack update, functions run mixed for a short time, so flip in a low-traffic window.
330
- - The cached layer under `layers/prisma` rebuilds on the flip: its marker records the Prisma binary target, the client set and the core and `@prisma/client` versions, and a mismatch rebuilds.
331
- - The first compose after upgrading to a Frigg release with this support rebuilds the Prisma layer once, because cache markers written by older releases never match.
304
+ With the opt-out, each nested package resolves whatever version is hoisted to the root, and a package whose root copy is a dev dependency is not shipped at all. The first `require` of such a package fails at Lambda init with `Runtime.ImportModuleError`.
332
305
 
333
306
  ## Usage Examples
334
307
 
@@ -37,9 +37,6 @@ jest.mock('../domains/shared/resource-discovery', () => {
37
37
  }),
38
38
  };
39
39
  });
40
- jest.mock('../domains/database/migration-engines', () => ({
41
- ensureMigrationEngines: jest.fn().mockResolvedValue(undefined),
42
- }));
43
40
 
44
41
  // createIntegrationRouter loads the app definition from the consuming
45
42
  // backend; give it an empty one so the router can be built in isolation.
@@ -36,9 +36,6 @@ const accountWithDefaultVpc = (overrides = {}) => ({
36
36
  defaultRouteTableId: 'rtb-12345',
37
37
  ...overrides,
38
38
  });
39
- jest.mock('../domains/database/migration-engines', () => ({
40
- ensureMigrationEngines: jest.fn().mockResolvedValue(undefined),
41
- }));
42
39
 
43
40
  const postgresApp = (postgres, extra = {}) => ({
44
41
  name: 'test-app',
@@ -146,6 +146,3 @@ describe('frigg init default infrastructure', () => {
146
146
  expect(definition.provider.logRetentionInDays).toBe(14);
147
147
  });
148
148
  });
149
- jest.mock('../domains/database/migration-engines', () => ({
150
- ensureMigrationEngines: jest.fn().mockResolvedValue(undefined),
151
- }));
@@ -24,9 +24,6 @@ jest.mock('../domains/shared/resource-discovery', () => {
24
24
  }),
25
25
  };
26
26
  });
27
- jest.mock('../domains/database/migration-engines', () => ({
28
- ensureMigrationEngines: jest.fn().mockResolvedValue(undefined),
29
- }));
30
27
 
31
28
  const buildApp = (overrides = {}) => ({
32
29
  name: 'scoped-test-app',
@@ -23,9 +23,6 @@ jest.mock('../domains/shared/resource-discovery', () => {
23
23
  }),
24
24
  };
25
25
  });
26
- jest.mock('../domains/database/migration-engines', () => ({
27
- ensureMigrationEngines: jest.fn().mockResolvedValue(undefined),
28
- }));
29
26
 
30
27
  const buildApp = (overrides = {}) => ({
31
28
  name: 'preload-test',
@@ -631,9 +631,6 @@ describe('CloudFormation Template Generation', () => {
631
631
  });
632
632
  });
633
633
  });
634
- jest.mock('../domains/database/migration-engines', () => ({
635
- ensureMigrationEngines: jest.fn().mockResolvedValue(undefined),
636
- }));
637
634
 
638
635
  // Helper functions
639
636
  function findAllRefs(obj, refs = []) {
@@ -40,9 +40,6 @@ jest.mock('./domains/shared/resource-discovery', () => {
40
40
  const actual = jest.requireActual('./domains/shared/resource-discovery');
41
41
  return { ...actual, gatherDiscoveredResources: jest.fn() };
42
42
  });
43
- jest.mock('./domains/database/migration-engines', () => ({
44
- ensureMigrationEngines: jest.fn().mockResolvedValue(undefined),
45
- }));
46
43
  jest.mock('./domains/shared/utilities/prisma-layer-manager', () => ({
47
44
  ensurePrismaLayerExists: jest.fn().mockResolvedValue(undefined),
48
45
  }));
@@ -281,7 +278,6 @@ const MATRIX = {
281
278
  },
282
279
  lambda: { scopedEnvironment: true, keepNestedNodeModules: false },
283
280
  usePrismaLambdaLayer: true,
284
- architecture: 'x86_64',
285
281
  }),
286
282
  'frigg init scaffold (external db, no vpc)': () => ({
287
283
  ...base(),
@@ -298,7 +294,6 @@ const MATRIX = {
298
294
  database: { postgres: { enable: true, management: 'external' } },
299
295
  logging: { retentionInDays: 14 },
300
296
  ssm: { enable: false },
301
- architecture: 'arm64',
302
297
  }),
303
298
  'external db, encryption none': () => ({
304
299
  ...base(),
@@ -16,7 +16,6 @@
16
16
  const { InfrastructureBuilder, ValidationResult } = require('../shared/base-builder');
17
17
  const { isScopedEnvironmentActive } = require('../shared/function-environments');
18
18
  const { nestedNodeModulesExcludes } = require('../shared/utilities/nested-node-modules');
19
- const { bundledPrismaEngineExcludes } = require('../shared/lambda-architectures');
20
19
 
21
20
  class AdminScriptBuilder extends InfrastructureBuilder {
22
21
  constructor() {
@@ -413,7 +412,6 @@ class AdminScriptBuilder extends InfrastructureBuilder {
413
412
  'node_modules/@friggframework/core/generated/**',
414
413
  ]
415
414
  : []),
416
- ...bundledPrismaEngineExcludes(appDefinition, usePrismaLayer),
417
415
  ...nestedNodeModulesExcludes(appDefinition, usePrismaLayer),
418
416
  'node_modules/@friggframework/test/**',
419
417
  'node_modules/@friggframework/eslint-config/**',
@@ -10,7 +10,6 @@
10
10
 
11
11
  const { AdminScriptBuilder } = require('./admin-script-builder');
12
12
  const { ValidationResult } = require('../shared/base-builder');
13
- const { itBundlesOnlyTheTargetPrismaEngine } = require('../../__tests__/helpers/bundled-prisma-engine-excludes');
14
13
 
15
14
  describe('AdminScriptBuilder', () => {
16
15
  let adminScriptBuilder;
@@ -964,21 +963,6 @@ describe('AdminScriptBuilder', () => {
964
963
  });
965
964
  });
966
965
 
967
- describe('Lambda architecture with usePrismaLambdaLayer=false', () => {
968
- const functionsOf = async (usePrismaLambdaLayer, architecture) => {
969
- const result = await adminScriptBuilder.build(
970
- {
971
- adminScripts: [{ Definition: { name: 'cleanup' } }],
972
- usePrismaLambdaLayer,
973
- ...(architecture && { architecture }),
974
- },
975
- {}
976
- );
977
- return Object.values(result.functions);
978
- };
979
- itBundlesOnlyTheTargetPrismaEngine(functionsOf);
980
- });
981
-
982
966
  describe('getName()', () => {
983
967
  it('should return AdminScriptBuilder', () => {
984
968
  expect(adminScriptBuilder.getName()).toBe('AdminScriptBuilder');
@@ -1041,23 +1025,23 @@ describe('AdminScriptBuilder nested node_modules (lambda.keepNestedNodeModules)'
1041
1025
  result.functions.adminScriptRouter,
1042
1026
  ];
1043
1027
 
1044
- it('excludes every nested node_modules by default', async () => {
1028
+ it('keeps nested node_modules by default, still excluding nested Frigg copies', async () => {
1045
1029
  const result = await new AdminScriptBuilder().build(appDefinition(), {});
1046
1030
 
1047
1031
  for (const fn of executorAndRouter(result)) {
1048
- expect(fn.package.exclude).toContain('node_modules/**/node_modules/**');
1032
+ expect(fn.package.exclude).not.toContain('node_modules/**/node_modules/**');
1033
+ expect(fn.package.exclude).toContain('node_modules/**/node_modules/@friggframework/**');
1049
1034
  }
1050
1035
  });
1051
1036
 
1052
- it('keeps nested node_modules when the app opts in, still excluding nested Frigg copies', async () => {
1037
+ it('excludes every nested node_modules when the app opts out', async () => {
1053
1038
  const result = await new AdminScriptBuilder().build(
1054
- appDefinition({ keepNestedNodeModules: true }),
1039
+ appDefinition({ keepNestedNodeModules: false }),
1055
1040
  {}
1056
1041
  );
1057
1042
 
1058
1043
  for (const fn of executorAndRouter(result)) {
1059
- expect(fn.package.exclude).not.toContain('node_modules/**/node_modules/**');
1060
- expect(fn.package.exclude).toContain('node_modules/**/node_modules/@friggframework/**');
1044
+ expect(fn.package.exclude).toContain('node_modules/**/node_modules/**');
1061
1045
  }
1062
1046
  });
1063
1047
  });
@@ -16,12 +16,6 @@
16
16
  const { InfrastructureBuilder, ValidationResult } = require('../shared/base-builder');
17
17
  const { isScopedEnvironmentActive } = require('../shared/function-environments');
18
18
  const { nestedNodeModulesExcludes } = require('../shared/utilities/nested-node-modules');
19
- const {
20
- resolveLambdaArchitecture,
21
- PRISMA_ENGINES_PACKAGE_DIR,
22
- prismaEngineFileNames,
23
- foreignPrismaEngineExcludes,
24
- } = require('../shared/lambda-architectures');
25
19
  const { MigrationResourceResolver } = require('./migration-resolver');
26
20
  const { createEmptyDiscoveryResult, ResourceOwnership } = require('../shared/types');
27
21
 
@@ -245,9 +239,6 @@ class MigrationBuilder extends InfrastructureBuilder {
245
239
  async createFunctionDefinitions(result, usePrismaLayer = true, appDefinition = {}) {
246
240
  console.log(' 🔍 DEBUG: createFunctionDefinitions called');
247
241
  console.log(' 🔍 DEBUG: result.functions is:', typeof result.functions, result.functions);
248
- const architecture = resolveLambdaArchitecture(appDefinition);
249
- const engineExcludes = foreignPrismaEngineExcludes(architecture.name);
250
- const engines = prismaEngineFileNames(architecture.prismaBinaryTarget);
251
242
  // Migration WORKER package config (needs Prisma CLI WASM files)
252
243
  const migrationWorkerPackageConfig = {
253
244
  individually: true,
@@ -302,14 +293,12 @@ class MigrationBuilder extends InfrastructureBuilder {
302
293
  'node_modules/@friggframework/core/handlers/routers/integration-*.js',
303
294
  'node_modules/@friggframework/core/handlers/workers/integration-*.js',
304
295
 
305
- // Exclude the engines of every platform and architecture this
306
- // stack does not run on
296
+ // Exclude wrong OS binaries
307
297
  '**/query-engine-darwin*',
308
298
  '**/schema-engine-darwin*',
309
299
  '**/libquery_engine-darwin*',
310
300
  '**/*-darwin-arm64*',
311
301
  '**/*-darwin*',
312
- ...engineExcludes,
313
302
 
314
303
  // Migration worker DOES need Prisma CLI WASM files (for migrate deploy)
315
304
  // Only exclude runtime engine WASM (query engine internals)
@@ -396,14 +385,12 @@ class MigrationBuilder extends InfrastructureBuilder {
396
385
  'node_modules/@friggframework/core/handlers/routers/integration-*.js',
397
386
  'node_modules/@friggframework/core/handlers/workers/**',
398
387
 
399
- // Exclude the engines of every platform and architecture this
400
- // stack does not run on
388
+ // Exclude wrong OS binaries
401
389
  '**/query-engine-darwin*',
402
390
  '**/schema-engine-darwin*',
403
391
  '**/libquery_engine-darwin*',
404
392
  '**/*-darwin-arm64*',
405
393
  '**/*-darwin*',
406
- ...engineExcludes,
407
394
 
408
395
  // Router doesn't run migrations - exclude ALL WASM files
409
396
  '**/runtime/*.wasm',
@@ -451,12 +438,6 @@ class MigrationBuilder extends InfrastructureBuilder {
451
438
  environment: {
452
439
  // Ensure migration functions get DATABASE_URL from provider.environment
453
440
  // Note: Serverless will merge this with provider.environment
454
-
455
- // Pin the migrate CLI to the shipped engines. With these set,
456
- // Prisma neither downloads an engine at cold start (into the
457
- // read-only /var/task) nor picks another file.
458
- PRISMA_SCHEMA_ENGINE_BINARY: `/var/task/${PRISMA_ENGINES_PACKAGE_DIR}/${engines.schemaEngine}`,
459
- PRISMA_QUERY_ENGINE_LIBRARY: `/var/task/${PRISMA_ENGINES_PACKAGE_DIR}/${engines.queryEngineLibrary}`,
460
441
  },
461
442
  events: [
462
443
  {
@@ -322,61 +322,6 @@ describe('MigrationBuilder', () => {
322
322
  });
323
323
  });
324
324
 
325
- describe('Lambda architecture (architecture)', () => {
326
- const baseAppDefinition = { database: { postgres: { enable: true } } };
327
- const workerAndRouter = (result) => [
328
- result.functions.dbMigrationWorker,
329
- result.functions.dbMigrationRouter,
330
- ];
331
-
332
- it.each([
333
- [undefined, 'rhel-openssl-3.0.x', 'linux-arm64-openssl-3.0.x'],
334
- ['x86_64', 'rhel-openssl-3.0.x', 'linux-arm64-openssl-3.0.x'],
335
- ['arm64', 'linux-arm64-openssl-3.0.x', 'rhel-openssl-3.0.x'],
336
- ])(
337
- 'with architecture %s the worker and router ship only the %s engines',
338
- async (architecture, target, otherTarget) => {
339
- const result = await builder.build(
340
- { ...baseAppDefinition, ...(architecture && { architecture }) },
341
- {}
342
- );
343
-
344
- for (const fn of workerAndRouter(result)) {
345
- expect(fn.package.exclude).toEqual(
346
- expect.arrayContaining([
347
- '**/libquery_engine-debian*',
348
- '**/libquery_engine-linux-musl*',
349
- `**/libquery_engine-${otherTarget}*`,
350
- ])
351
- );
352
- expect(fn.package.exclude).not.toContain(`**/libquery_engine-${target}*`);
353
- }
354
- }
355
- );
356
-
357
- it.each([
358
- [undefined, 'rhel-openssl-3.0.x'],
359
- ['x86_64', 'rhel-openssl-3.0.x'],
360
- ['arm64', 'linux-arm64-openssl-3.0.x'],
361
- ])(
362
- 'with architecture %s the worker pins the migrate CLI to the shipped %s engines',
363
- async (architecture, target) => {
364
- const result = await builder.build(
365
- { ...baseAppDefinition, ...(architecture && { architecture }) },
366
- {}
367
- );
368
-
369
- expect(result.functions.dbMigrationWorker.environment).toEqual(
370
- expect.objectContaining({
371
- PRISMA_SCHEMA_ENGINE_BINARY: `/var/task/node_modules/@prisma/engines/schema-engine-${target}`,
372
- PRISMA_QUERY_ENGINE_LIBRARY: `/var/task/node_modules/@prisma/engines/libquery_engine-${target}.so.node`,
373
- })
374
- );
375
- expect(result.functions.dbMigrationRouter.environment.PRISMA_SCHEMA_ENGINE_BINARY).toBeUndefined();
376
- }
377
- );
378
- });
379
-
380
325
  describe('scoped environment (lambda.scopedEnvironment)', () => {
381
326
  beforeEach(() => {
382
327
  delete process.env.FRIGG_SKIP_AWS_DISCOVERY;
@@ -487,23 +432,23 @@ describe('MigrationBuilder nested node_modules (lambda.keepNestedNodeModules)',
487
432
  result.functions.dbMigrationRouter,
488
433
  ];
489
434
 
490
- it('excludes every nested node_modules by default', async () => {
435
+ it('keeps nested node_modules by default, still excluding nested Frigg copies', async () => {
491
436
  const result = await new MigrationBuilder().build(baseAppDefinition, {});
492
437
 
493
438
  for (const fn of workerAndRouter(result)) {
494
- expect(fn.package.exclude).toContain('node_modules/**/node_modules/**');
439
+ expect(fn.package.exclude).not.toContain('node_modules/**/node_modules/**');
440
+ expect(fn.package.exclude).toContain('node_modules/**/node_modules/@friggframework/**');
495
441
  }
496
442
  });
497
443
 
498
- it('keeps nested node_modules when the app opts in, still excluding nested Frigg copies', async () => {
444
+ it('excludes every nested node_modules when the app opts out', async () => {
499
445
  const result = await new MigrationBuilder().build(
500
- { ...baseAppDefinition, lambda: { keepNestedNodeModules: true } },
446
+ { ...baseAppDefinition, lambda: { keepNestedNodeModules: false } },
501
447
  {}
502
448
  );
503
449
 
504
450
  for (const fn of workerAndRouter(result)) {
505
- expect(fn.package.exclude).not.toContain('node_modules/**/node_modules/**');
506
- expect(fn.package.exclude).toContain('node_modules/**/node_modules/@friggframework/**');
451
+ expect(fn.package.exclude).toContain('node_modules/**/node_modules/**');
507
452
  }
508
453
  });
509
454
  });
@@ -32,7 +32,6 @@ const {
32
32
  const {
33
33
  nestedNodeModulesExcludes,
34
34
  } = require('../shared/utilities/nested-node-modules');
35
- const { bundledPrismaEngineExcludes } = require('../shared/lambda-architectures');
36
35
  const {
37
36
  INTEGRATION_QUEUE_MAX_RECEIVE_COUNT,
38
37
  QUEUE_MAX_RECEIVE_COUNT_ENV,
@@ -269,7 +268,6 @@ class IntegrationBuilder extends InfrastructureBuilder {
269
268
  'node_modules/@friggframework/core/generated/**',
270
269
  ]
271
270
  : []),
272
- ...bundledPrismaEngineExcludes(appDefinition, usePrismaLayer),
273
271
 
274
272
  ...nestedNodeModulesExcludes(appDefinition, usePrismaLayer),
275
273
 
@@ -10,7 +10,6 @@ const {
10
10
  } = require('@friggframework/core/queues/queue-delivery');
11
11
  const { IntegrationBuilder } = require('./integration-builder');
12
12
  const { ValidationResult } = require('../shared/base-builder');
13
- const { itBundlesOnlyTheTargetPrismaEngine } = require('../../__tests__/helpers/bundled-prisma-engine-excludes');
14
13
 
15
14
  describe('IntegrationBuilder', () => {
16
15
  let integrationBuilder;
@@ -1086,21 +1085,6 @@ describe('IntegrationBuilder', () => {
1086
1085
  });
1087
1086
 
1088
1087
 
1089
- describe('IntegrationBuilder Lambda architecture with usePrismaLambdaLayer=false', () => {
1090
- const functionsOf = async (usePrismaLambdaLayer, architecture) => {
1091
- const result = await new IntegrationBuilder().build(
1092
- {
1093
- integrations: [{ Definition: { name: 'crm' } }],
1094
- usePrismaLambdaLayer,
1095
- ...(architecture && { architecture }),
1096
- },
1097
- {}
1098
- );
1099
- return Object.values(result.functions);
1100
- };
1101
- itBundlesOnlyTheTargetPrismaEngine(functionsOf);
1102
- });
1103
-
1104
1088
  describe('IntegrationBuilder nested node_modules (lambda.keepNestedNodeModules)', () => {
1105
1089
  const appDefinition = (lambda) => ({
1106
1090
  integrations: [{ Definition: { name: 'test', webhooks: true } }],
@@ -1109,24 +1093,24 @@ describe('IntegrationBuilder nested node_modules (lambda.keepNestedNodeModules)'
1109
1093
  const packagedFunctions = (result) =>
1110
1094
  Object.values(result.functions).filter((fn) => fn.package?.exclude);
1111
1095
 
1112
- it('excludes every nested node_modules by default', async () => {
1096
+ it('keeps nested node_modules by default, still excluding nested Frigg copies', async () => {
1113
1097
  const result = await new IntegrationBuilder().build(appDefinition(), {});
1114
1098
 
1115
1099
  expect(packagedFunctions(result).length).toBeGreaterThan(0);
1116
1100
  for (const fn of packagedFunctions(result)) {
1117
- expect(fn.package.exclude).toContain('node_modules/**/node_modules/**');
1101
+ expect(fn.package.exclude).not.toContain('node_modules/**/node_modules/**');
1102
+ expect(fn.package.exclude).toContain('node_modules/**/node_modules/@friggframework/**');
1118
1103
  }
1119
1104
  });
1120
1105
 
1121
- it('keeps nested node_modules when the app opts in, still excluding nested Frigg copies', async () => {
1106
+ it('excludes every nested node_modules when the app opts out', async () => {
1122
1107
  const result = await new IntegrationBuilder().build(
1123
- appDefinition({ keepNestedNodeModules: true }),
1108
+ appDefinition({ keepNestedNodeModules: false }),
1124
1109
  {}
1125
1110
  );
1126
1111
 
1127
1112
  for (const fn of packagedFunctions(result)) {
1128
- expect(fn.package.exclude).not.toContain('node_modules/**/node_modules/**');
1129
- expect(fn.package.exclude).toContain('node_modules/**/node_modules/@friggframework/**');
1113
+ expect(fn.package.exclude).toContain('node_modules/**/node_modules/**');
1130
1114
  }
1131
1115
  });
1132
1116
  });
@@ -10,10 +10,6 @@
10
10
  const { buildEnvironment } = require('../environment-builder');
11
11
  const { nestedNodeModulesExcludes } = require('./nested-node-modules');
12
12
  const { buildLoggingProviderConfig } = require('./logging-config');
13
- const {
14
- resolveLambdaArchitecture,
15
- bundledPrismaEngineExcludes,
16
- } = require('../lambda-architectures');
17
13
 
18
14
  /**
19
15
  * Create base serverless definition with core functions and resources
@@ -39,8 +35,6 @@ function createBaseDefinition(
39
35
  ) {
40
36
  const region = process.env.AWS_REGION || 'us-east-1';
41
37
  const loggingConfig = buildLoggingProviderConfig(AppDefinition.logging);
42
- const architecture = resolveLambdaArchitecture(AppDefinition);
43
- const bundledEngineExcludes = bundledPrismaEngineExcludes(AppDefinition, usePrismaLayer);
44
38
 
45
39
  // Package config for handlers that skip esbuild (need node_modules dependencies)
46
40
  // Include backend src/ and index.js since handlers load the app definition
@@ -60,7 +54,6 @@ function createBaseDefinition(
60
54
  'node_modules/prisma/**',
61
55
  'node_modules/@friggframework/core/generated/**',
62
56
  ] : []),
63
- ...bundledEngineExcludes,
64
57
 
65
58
  // Exclude AWS SDK (provided by Lambda runtime)
66
59
  'node_modules/aws-sdk/**',
@@ -134,7 +127,6 @@ function createBaseDefinition(
134
127
  'node_modules/prisma/**',
135
128
  'node_modules/@friggframework/core/generated/**',
136
129
  ] : []),
137
- ...bundledEngineExcludes,
138
130
 
139
131
  // Exclude nested node_modules from symlinked frigg packages (for npm link development)
140
132
  'node_modules/@friggframework/core/node_modules/**',
@@ -186,7 +178,6 @@ function createBaseDefinition(
186
178
  name: AppDefinition.provider || 'aws',
187
179
  ...(process.env.AWS_PROFILE && { profile: process.env.AWS_PROFILE }),
188
180
  runtime: 'nodejs22.x', // Node.js 22.x (latest Lambda runtime with AWS SDK v3)
189
- ...(architecture.explicit && { architecture: architecture.name }),
190
181
  timeout: 29, // Set to 29s to give buffer before API Gateway's 30s timeout
191
182
  region,
192
183
  stage: '${opt:stage}',
@@ -350,11 +341,8 @@ function createBaseDefinition(
350
341
  prisma: {
351
342
  path: 'layers/prisma',
352
343
  name: '${self:service}-prisma-${sls:stage}',
353
- description: 'Prisma runtime client only (NO CLI) with the query engine for the deployed Lambda architecture (~10-15MB). CLI packaged separately in dbMigrate function.',
344
+ description: 'Prisma runtime client only (NO CLI) with rhel-openssl-3.0.x binaries (~10-15MB). CLI packaged separately in dbMigrate function.',
354
345
  compatibleRuntimes: ['nodejs20.x', 'nodejs22.x'],
355
- ...(architecture.explicit && {
356
- compatibleArchitectures: [architecture.name],
357
- }),
358
346
  retain: false,
359
347
  },
360
348
  } : {},
@@ -5,7 +5,6 @@
5
5
  */
6
6
 
7
7
  const { createBaseDefinition } = require('./base-definition-factory');
8
- const { itBundlesOnlyTheTargetPrismaEngine } = require('../../../__tests__/helpers/bundled-prisma-engine-excludes');
9
8
 
10
9
  describe('Base Definition Factory', () => {
11
10
  beforeEach(() => {
@@ -324,65 +323,19 @@ describe('Base Definition Factory', () => {
324
323
  });
325
324
 
326
325
 
327
- describe('Lambda architecture (architecture)', () => {
328
- const build = (appDefinition) => createBaseDefinition(appDefinition, {}, {}, true);
329
-
330
- it('adds no architecture fields when the key is unset, so existing templates do not change', () => {
331
- const result = build({ name: 'test-app' });
332
-
333
- expect(result.provider.architecture).toBeUndefined();
334
- expect(result.layers.prisma.compatibleArchitectures).toBeUndefined();
335
- });
336
-
337
- it.each(['x86_64', 'arm64'])(
338
- 'sets provider.architecture and the layer compatibleArchitectures to %s when set',
339
- (architecture) => {
340
- const result = build({ name: 'test-app', architecture });
341
-
342
- expect(result.provider.architecture).toBe(architecture);
343
- expect(result.layers.prisma.compatibleArchitectures).toEqual([architecture]);
344
- }
345
- );
346
-
347
- it('describes the layer without naming an engine, since the engine follows the architecture', () => {
348
- const result = build({ name: 'test-app' });
349
-
350
- expect(result.layers.prisma.description).not.toContain('rhel');
351
- });
352
-
353
- it('rejects an architecture the registry does not know', () => {
354
- expect(() => build({ name: 'test-app', architecture: 'aarch64' })).toThrow(
355
- /aarch64/
356
- );
357
- });
358
- });
359
-
360
- describe('Lambda architecture with usePrismaLambdaLayer=false', () => {
361
- const functionsOf = (usePrismaLayer, architecture) => {
362
- const result = createBaseDefinition(
363
- { name: 'test-app', ...(architecture && { architecture }) },
364
- {},
365
- {},
366
- usePrismaLayer
367
- );
368
- return Object.values(result.functions);
369
- };
370
- itBundlesOnlyTheTargetPrismaEngine(functionsOf);
371
- });
372
-
373
326
  describe('nested node_modules (lambda.keepNestedNodeModules)', () => {
374
327
  const build = (appDefinition) => createBaseDefinition(appDefinition, {}, {}, true);
375
328
 
376
- it('excludes every nested node_modules from the core function packages by default', () => {
377
- const result = build({ name: 'test-app' });
329
+ it('excludes every nested node_modules from the core function packages when the app opts out', () => {
330
+ const result = build({ name: 'test-app', lambda: { keepNestedNodeModules: false } });
378
331
 
379
332
  for (const fn of ['auth', 'user', 'health']) {
380
333
  expect(result.functions[fn].package.exclude).toContain('node_modules/**/node_modules/**');
381
334
  }
382
335
  });
383
336
 
384
- it('keeps nested node_modules when the app opts in, still excluding nested Frigg, AWS SDK and Prisma copies', () => {
385
- const result = build({ name: 'test-app', lambda: { keepNestedNodeModules: true } });
337
+ it('keeps nested node_modules by default, still excluding nested Frigg, AWS SDK and Prisma copies', () => {
338
+ const result = build({ name: 'test-app' });
386
339
 
387
340
  for (const fn of ['auth', 'user', 'health']) {
388
341
  const { exclude } = result.functions[fn].package;
@@ -6,10 +6,11 @@
6
6
  * npm nests a package only when the root copy cannot satisfy the dependant's
7
7
  * range. Excluding every nested node_modules from a Lambda package therefore
8
8
  * rewires module resolution to whatever is hoisted, and drops a package
9
- * outright when the root copy is dev-only. Apps opt in to shipping the tree
10
- * the way npm resolved it with `lambda.keepNestedNodeModules: true`. Nested
11
- * copies of Frigg packages, the AWS SDK and Prisma stay excluded because the
12
- * app's single core, the Lambda runtime and the Prisma layer provide them.
9
+ * outright when the root copy is dev-only. Function packages ship the tree the
10
+ * way npm resolved it unless an app opts out with
11
+ * `lambda.keepNestedNodeModules: false`. Nested copies of Frigg packages, the
12
+ * AWS SDK and Prisma stay excluded because the app's single core, the Lambda
13
+ * runtime and the Prisma layer provide them.
13
14
  */
14
15
 
15
16
  const ALL_NESTED_NODE_MODULES = 'node_modules/**/node_modules/**';
@@ -19,7 +20,7 @@ const ALL_NESTED_NODE_MODULES = 'node_modules/**/node_modules/**';
19
20
  * @returns {boolean}
20
21
  */
21
22
  function keepsNestedNodeModules(appDefinition = {}) {
22
- return appDefinition.lambda?.keepNestedNodeModules === true;
23
+ return appDefinition.lambda?.keepNestedNodeModules !== false;
23
24
  }
24
25
 
25
26
  /**