{"record":{"id":"a77df66d91fb71a8","repo":"serverless/serverless","slug":"lambda-invalid-memory-size","errorCode":"LAMBDA_INVALID_MEMORY_SIZE","errorMessage":"Memory size of ${effectiveMemory} MB of function \"${functionName}\" exceeds the limit of 10240 MB for standard functions. Increase is supported only for functions using capacity providers.","messagePattern":"Memory size of (.+?) MB of function \"(.+?)\" exceeds the limit of 10240 MB for standard functions\\. Increase is supported only for functions using capacity providers\\.","errorType":"exception","errorClass":"ServerlessError","httpStatus":null,"severity":"error","filePath":"packages/serverless/lib/plugins/aws/package/compile/functions.js","lineNumber":284,"sourceCode":"    // function, fail fast with a clear error instead of letting CloudFormation\n    // return a generic 400.\n    if (\n      functionObject.capacityProvider &&\n      effectiveMemory < 2048 &&\n      (explicitFunctionMemory != null || explicitProviderMemory != null)\n    ) {\n      throw new ServerlessError(\n        `Functions using capacityProvider must have memory size at least 2048 MB; received ${effectiveMemory} for function \"${functionName}\".`,\n        'LAMBDA_MANAGED_INSTANCES_INVALID_MEMORY_SIZE',\n        { stack: false },\n      )\n    }\n\n    // Standard Lambda functions (without capacity provider) are limited to 10240 MB.\n    // The schema allows up to 32GB to support capacity providers, so we must enforce\n    // the lower limit here for standard functions.\n    if (!functionObject.capacityProvider && effectiveMemory > 10240) {\n      throw new ServerlessError(\n        `Memory size of ${effectiveMemory} MB of function \"${functionName}\" exceeds the limit of 10240 MB for standard functions. Increase is supported only for functions using capacity providers.`,\n        'LAMBDA_INVALID_MEMORY_SIZE',\n        { stack: false },\n      )\n    }\n\n    functionObject.memory = effectiveMemory\n    if (!functionObject.timeout) {\n      functionObject.timeout = this.serverless.service.provider.timeout || 6\n    }\n\n    let artifactFilePath\n\n    if (functionObject.handler) {\n      const serviceArtifactFileName =\n        this.provider.naming.getServiceArtifactName()\n      const functionArtifactFileName =\n        this.provider.naming.getFunctionArtifactName(functionName)","sourceCodeStart":266,"sourceCodeEnd":302,"githubUrl":"https://github.com/serverless/serverless/blob/b9d7ea51c8cce57cff1207964b9b71123673081f/packages/serverless/lib/plugins/aws/package/compile/functions.js#L266-L302","documentation":"Thrown during Lambda function compilation when a STANDARD Lambda function (no 'capacityProvider') has an effective memory size above 10240 MB (10 GB). The JSON schema allows up to 32 GB to support capacity providers, so this runtime check at functions.js:283-289 enforces the 10 GB ceiling for ordinary Lambda functions with { stack: false }.","triggerScenarios":"Setting 'memorySize: 12288' on a function without capacityProvider; or provider-level memorySize > 10240 applied to a standard function.","commonSituations":"Raising memory assuming standard Lambda supports the same 32 GB ceiling as managed instances; copy-pasting a capacity-provider memorySize onto a standard function; typo (e.g., 11264 instead of 1126).","solutions":["Lower memorySize to 10240 or below for standard Lambda functions.","Configure 'capacityProvider' on the function to unlock memory above 10240 MB.","Audit for provider-level memorySize that might be inherited by this standard function."],"exampleFix":"# before\nfunctions:\n  myFn:\n    handler: index.handler\n    memorySize: 12288\n# after\nfunctions:\n  myFn:\n    handler: index.handler\n    memorySize: 10240","handlingStrategy":"validation","validationCode":"function validateStandardLambdaMemory(functions, provider) {\n  const providerMem = provider && provider.memorySize\n  for (const [name, fn] of Object.entries(functions || {})) {\n    if (fn.capacityProvider) continue\n    const mem = fn.memorySize != null ? fn.memorySize : (providerMem != null ? providerMem : 1024)\n    if (mem > 10240) {\n      throw new Error(`Function ${name}: standard Lambda memory must be <= 10240 MB; got ${mem}`)\n    }\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep standard Lambda memorySize <= 10240 MB.","Reserve > 10240 only for functions with capacityProvider set.","Double-check any provider-level memorySize that propagates to standard functions."],"tags":["aws","lambda","memory","config","validation"],"backgroundTag":null,"analyzedSha":"b9d7ea51c8cce57cff1207964b9b71123673081f","analyzedAt":"2026-08-13T04:14:40.386Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}