在嘗試部署我的基礎架構時,我遇到了這個錯誤:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
ERRO[0000] Can't add file /Users/Samuel.Lawrence/uktv/Sandbox/cdk-arch/node_modules/aws-cdk-lib/aws-lambda-nodejs/lib/types.d.ts to tar: io: read/write on closed pipe
ERRO[0000] Can't close tar writer: io: read/write on closed pipe
我的基礎設施非常簡單,看起來就像:
類那個索引:index.ts
export class CdkArchStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);
new AnalyticsReportService(this, "AnalyticsReportServiceHandler", {});
}
}
處理堆疊創建的類:AnalyticsReportService.ts
export class AnalyticsReportService extends NodejsFunction {
constructor(scope: Stack, id: string, props: NodejsFunctionProps) {
super(scope, id, props);
}
}
最后,一個基本的 lambda 函式:
export const handler = async (event: any = {}): Promise<any> => {
console.log("event: ", event);
return {
statusCode: 200,
body: JSON.stringify({
message: "Go Serverless v2.0! Your function executed successfully!",
}),
};
};
我到底錯過了什么?這個錯誤似乎很常見。我已經登錄到我的 aws 控制臺,所以憑據肯定不是問題所在
uj5u.com熱心網友回復:
需要 Docker 才能在沒有esbuild
. 所以安裝/啟動 Docker 或安裝 esbuild。
參考:“如果 esbuild 可用,它將用于將您的代碼捆綁到您的環境中。否則,將在 Lambda 兼容的 Docker 容器中與基于 Lambda 函式的目標架構的 Docker 平臺進行捆綁。”
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/527582.html
標籤:打字稿亚马逊网络服务aws-lambdaaws-cdk
下一篇:如何遍歷節點樹并修改其結構和值