6

We are using Vapor to deploy our Laravel App to AWS Lambda.

After small change (10 lines were introduced), the deploy process via GitHub action fails with the following message:

Message: Your application exceeds the maximum size allowed by AWS Lambda.

Now we can not deploy to this env (develop). All other branches (staging, production) are fine and we can use them.

No new libraries or any big changes were introduced between the last deploy.

Deploy via Vapor CLI also fails with the same message.

Any ideas where we can search for the source of the problem?

2
  • What is the size of your deployment package? Commented Jun 29, 2020 at 14:20
  • @HarishKM on the dev branch it is slightly above 45 MB. On all other branches, it is around 28 MB. Commented Jun 29, 2020 at 15:10

2 Answers 2

2

Lambda deployment packages have a size limit of 50 MB. The deployment package of your dev branch is crossing that limit. That's why you get the error Your application exceeds the maximum size allowed by AWS Lambda.

If reducing the size of your deployment package is not an option, upload the package to S3 & provide the S3 URL to the Lambda function. The deployment package is allowed to have a max size of 250 MB (uncompressed) when you go the S3 route.

See my blog post for more details!

Sign up to request clarification or add additional context in comments.

1 Comment

How would this work in the context of a Laravel Vapor project?
2

You can switch to a Docker Runtime. Docker deploys can be up to 10GB.

First foreach environment, create a Docker file with the name <environment>.Dockerfile, for example production.Dockerfile for the production environment.

Then in that file put:

FROM laravelphp/vapor:php81

COPY . /var/task

Then change the "runtime" for each environment in vapor.yml to "docker".

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.