首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >发生错误: ArtisanLambdaFunction -解压缩大小必须小于220606645字节(服务: Lambda,状态代码: 4000

发生错误: ArtisanLambdaFunction -解压缩大小必须小于220606645字节(服务: Lambda,状态代码: 4000
EN

Stack Overflow用户
提问于 2021-08-13 12:26:33
回答 1查看 293关注 0票数 0

我试图使用Bref将我的Laravel应用程序部署到AWS Lambda。我试着把几乎所有的图像,视频都排除在外,但我还是得到了

代码语言:javascript
复制
Serverless Error ----------------------------------------
An error occurred: ArtisanLambdaFunction - Resource handler returned message: "Unzipped size must be smaller than 235311048 bytes (Service: Lambda, Status Code: 400 ...

我的serverless.yml文件是

代码语言:javascript
复制
service: my-laravel-application

provider:
    name: aws
    # The AWS region in which to deploy (us-east-1 is the default)
    region: eu-west-1
    # The stage of the application, e.g. dev, production, staging… ('dev' is the default)
    stage: dev
    runtime: provided.al2

package:
    individually: true
    # Directories to exclude from deployment
    exclude:
        - node_modules/**
        - public/storage/**
        - resources/assets/**
        - storage/**
        - tests/**
        - public/images/**
        - public/uploads/**
        - public/videos/**

functions:
    # This function runs the Laravel website/API
    web:
        handler: public/index.php
        timeout: 28 # in seconds (API Gateway has a timeout of 29 seconds)
        layers:
            - ${bref:layer.php-74-fpm}
        events:
            -   httpApi: '*'
    # This function lets us run artisan commands in Lambda
    artisan:
        handler: artisan
        timeout: 120 # in seconds
        layers:
            - ${bref:layer.php-74} # PHP
            - ${bref:layer.console} # The "console" layer

 plugins:  
    # We need to include the Bref plugin
    - ./vendor/bref/bref 

我试图把几乎所有的资产都排除在外。尽管如此,我还是会犯同样的错误。在压缩时,我的应用程序的总大小仅为119.4 MB。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-09-27 16:46:46

我可以通过添加所有公共资产来排除list来解决这个问题,从而将zip文件的大小减少到43 MB。

在提取zip时,解压缩的总大小小于220606645字节。

然后,

  1. 将所有公用文件夹文件和文件夹上载到S3
  2. Add ASSET_URL in env
  3. 使用资产()函数,只要我们尝试访问S3

中的文件

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68772307

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档