Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chalice deployment fails due to large package size #2115

Open
shekharpalit opened this issue Jul 30, 2024 · 2 comments
Open

Chalice deployment fails due to large package size #2115

shekharpalit opened this issue Jul 30, 2024 · 2 comments

Comments

@shekharpalit
Copy link

Description

My Chalice application is failing to deploy due to the deployment package exceeding the 50MB limit for Lambda functions. The application includes Langchain packages for data processing, which contribute to the large package size.

Current Configuration

My config.json for the Chalice application:

{
  "app_name": "my-app-name",
  "automatic_layer": true,
  "stages": {
    "prod": {
      "api_gateway_stage": "api",
      "environment_variables": {},
      "iam_role_arn": "r",
      "manage_iam_role": false,
      "lambda_memory_size": 3008,
      "lambda_timeout": 900
    },
    "staging": {
      "api_gateway_stage": "api",
      "environment_variables": {},
      "iam_role_arn": "r",
      "log_level": "DEBUG",
      "manage_iam_role": false,
      "lambda_memory_size": 3008,
      "lambda_timeout": 900
    }
  },
  "version": "2.0"
}

Error Message

chalice.deploy.deployer.ChaliceDeploymentError: ERROR - While sending your chalice handler code to Lambda to 
publish_layer_version function "my-fucntion-name-layer", 
received the following error:
 An error occurred (RequestEntityTooLargeException) when calling the 
 PublishLayerVersion operation: Request must be smaller than 70167211 bytes for
  the PublishLayerVersion operation
This is likely because the deployment package is 51.0 MB. Lambda only allows 
deployment packages that are 50.0 MB or less in size. To avoid this error, 
decrease the size of your chalice application by removing code or removing 
dependencies from your chalice application.

Question

How can I create multiple layers for my Lambda function to support deployments larger than 50MB? I'm using Langchain packages for data processing, which are contributing to the large package size.

Additional Information

  • The current deployment package size is 51.0 MB
  • Lambda's size limit is 50.0 MB
  • I'm using Langchain packages for data processing

What I've Tried

  • I've enabled automatic_layer: true in the config, but it doesn't seem to solve the issue
@josiahcoad
Copy link

same, same :(

@marcelo-bn
Copy link

marcelo-bn commented Nov 4, 2024

Hey, I am having the same issue.

I created manually a layer for the lib that I want to use (borb) and added in the config.json the field layers with my layer's ARN.

Chalice associated corectly the layer to the lambda, but I am still getting the error:

"[ERROR] Runtime.ImportModuleError: Unable to import module 'app': No module named 'borb' Traceback (most recent call last):"

Does someone has an ideia how to solve this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants