diff --git a/packages/runtime/src/helpers/functions.ts b/packages/runtime/src/helpers/functions.ts index 283b86a9fc..fdf9752d91 100644 --- a/packages/runtime/src/helpers/functions.ts +++ b/packages/runtime/src/helpers/functions.ts @@ -16,6 +16,7 @@ import { HANDLER_FUNCTION_TITLE, ODB_FUNCTION_TITLE, IMAGE_FUNCTION_TITLE, + LAMBDA_WARNING_SIZE, } from '../constants' import { getApiHandler } from '../templates/getApiHandler' import { getHandler } from '../templates/getHandler' @@ -314,8 +315,6 @@ const getBundleWeight = async (patterns: string[]) => { return sum(sizes.flat(1)) } -const MB = 1024 * 1024 - export const getAPILambdas = async ( publish: string, baseDir: string, @@ -323,7 +322,7 @@ export const getAPILambdas = async ( ): Promise => { const commonDependencies = await getAPIPRouteCommonDependencies(publish) - const threshold = 50 * MB - (await getBundleWeight(commonDependencies)) + const threshold = LAMBDA_WARNING_SIZE - (await getBundleWeight(commonDependencies)) const apiRoutes = await getApiRouteConfigs(publish, baseDir, pageExtensions)