Skip to content

Commit eb30624

Browse files
Skn0ttnickytonline
andauthored
refactor: use LAMBDA_WARNING_SIZE as packing threshold (#2156)
* refactor: use LAMBDA_WARNING_SIZE as packing threshold * chore: remove leftover test * Update test/helpers/functionsMetaData.spec.ts Co-authored-by: Nick Taylor <[email protected]> --------- Co-authored-by: Nick Taylor <[email protected]>
1 parent 6bdaec1 commit eb30624

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

packages/runtime/src/helpers/functions.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
HANDLER_FUNCTION_TITLE,
1717
ODB_FUNCTION_TITLE,
1818
IMAGE_FUNCTION_TITLE,
19+
LAMBDA_WARNING_SIZE,
1920
} from '../constants'
2021
import { getApiHandler } from '../templates/getApiHandler'
2122
import { getHandler } from '../templates/getHandler'
@@ -314,16 +315,14 @@ const getBundleWeight = async (patterns: string[]) => {
314315
return sum(sizes.flat(1))
315316
}
316317

317-
const MB = 1024 * 1024
318-
319318
export const getAPILambdas = async (
320319
publish: string,
321320
baseDir: string,
322321
pageExtensions: string[],
323322
): Promise<APILambda[]> => {
324323
const commonDependencies = await getAPIPRouteCommonDependencies(publish)
325324

326-
const threshold = 50 * MB - (await getBundleWeight(commonDependencies))
325+
const threshold = LAMBDA_WARNING_SIZE - (await getBundleWeight(commonDependencies))
327326

328327
const apiRoutes = await getApiRouteConfigs(publish, baseDir, pageExtensions)
329328

0 commit comments

Comments
 (0)