嘗試使用 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 的記憶體,這在您的情況下是不夠的。
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/405272.html
標籤:
