【发布时间】:2021-03-19 18:02:25
【问题描述】:
Amazon 的 SAM CLI 不会在不重建的情况下获取更改。文档听起来好像我每次更改函数时都不必启动/重建/重新启动。事实上,发出sam local start-api 命令会提供以下消息...
You do not need to restart/reload SAM CLI while working on your
functions, changes will be reflected instantly/automatically.
You only need to restart SAM CLI if you update your AWS SAM template.
但是,不会自动检测到更改。所以,改变这个...
const test = async (event, context) => {
const body = JSON.parse(event.body || {});
return toResponse(body);
};
...到这个...
const test = async (event, context) => {
const body = JSON.parse(event.body || {});
body.date = new Date();
return toResponse(body);
};
...应该使body 变量包含date 属性。不幸的是,强制执行此操作的唯一方法是停止 (CTRL+C),然后...
sam build
sam local start-api
这是一种折磨,因为 sam build 在 32GB i7 MacBook Pro 上需要将近一分钟。
【问题讨论】:
标签: aws-lambda aws-sam aws-sam-cli