【发布时间】:2021-09-22 17:48:30
【问题描述】:
I am using the default HelloWorld example 我的代码是:
let response;
exports.lambdaHandler = async (event, context) => {
console.log(event);
try {
response = {
'statusCode': 200,
'body': JSON.stringify({
message: 'hello world'
})
}
} catch (err) {
console.log(err);
return err;
}
return response
};
一切都按预期进行。我以sam local start-api 或sam local start-api --debug 开头
我的问题,我在哪里可以看到console.log(event);的输出
目前我只能看到{。
如果放一个字符串,比如 'AAAAAAA',我会在我输入 sam local start-api 的终端中看到它(如预期的那样)。
我遗漏了什么以便查看完整的本地日志?
【问题讨论】:
-
你试过了吗,
console.log(JSON.stringify(event));或sam local start-api --log-file logfile.txt -
我尝试了 ``` --log-file``` 但路径完整。将尝试不使用并将其转换为字符串,并在我知道后更新问题
-
@petey put console.log(JSON.stringify(event));作为答案,我会接受它-我自己应该想出来的:-D(浏览器端开发太多)
标签: node.js amazon-web-services aws-lambda aws-sam aws-sam-cli