尝试使用 AWS CDK 部署 Gatsby 站点,但 BucketDeployment 始终失败并显示错误讯息:
CREATE_FAILED | Custom::CDKBucketDeployment | DeploySiteCustomResourceE47C9748 Received response status [FAILED] from custom resource. Message returned: Command '['/opt/awscli/aws', 's3', 'cp', 's3://cdk-XXXXX-assets-XXXXXX-eu-west-2/assets/XXXXXXXX.zip', '/tmp/tmpXXX/XXXXX']' died with <Signals.SIGKILL: 9>
档案大小仅为 163MB,因此不超过 500MB 的限制。
使用 gatsby-plugin-s3 我得到一个错误,说该站点有超过 50 条路由规则。
我怎样才能用 CDK 解决这个问题?我曾尝试使用 website-redirect-location 但这也不起作用。
桶部署
const bucket = new s3.Bucket(this, "Testbucket", {
bucketName: "my-test-bucket",
publicReadAccess: true,
removalPolicy: cdk.RemovalPolicy.DESTROY,
websiteIndexDocument: "index.html"
});
new s3Deploy.BucketDeployment(this, "DeploySite", {
sources: [s3Deploy.Source.asset("../gatsby-site/public")],
destinationBucket: bucket,
metadata: { "website-redirect-location": "index.html"}
});
uj5u.com热心网友回复:
负责解压缩存档并将内容复制到目标的 lambda 因存储器不足而崩溃。
memoryLimit
创建BucketDeployment
构造时增加它的存储器。默认情况下,lambda 获得 128MB 的存储器,这在您的情况下是不够的。
0 评论