我只是创建了一个包含内容的 lambda 函数(文件名为 check.js):
exports.handler = async (event, context, callback) => {
console.log("My message");
};
以及template.yaml的内容
AWSTemplateFormatVersion : '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: My first serverless application.
Resources:
CreateOrder:
Type: AWS::Serverless::Function
Properties:
Handler: check.handler
Runtime: nodejs8.10
Timeout: 30
MemorySize: 512
Events:
Step1:
Type: Api
Properties:
Path: /
Method: any
之后我使用命令:sam local start-api
我收到错误:
Fetching lambci/lambda:nodejs8.10 Docker container image......
2018-11-19 11:33:48 Mounting D:\project\lambda1\BbeOrder as /var/task:ro inside runtime container
[32mSTART RequestId: 5b55437b-da83-132e-ea70-7661e1dbe757 Version: $LATEST[0m
[31mUnable to import module 'check': Error[0m
[31m at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)[0m
[32mEND RequestId: 5b55437b-da83-132e-ea70-7661e1dbe757[0m
[32mREPORT RequestId: 5b55437b-da83-132e-ea70-7661e1dbe757 Duration: 3.66 ms Billed Duration: 100 ms Memory Size: 512 MB Max Memory Used: 31 MB [0m
2018-11-19 11:33:49 No Content-Type given. Defaulting to 'application/json'.
2018-11-19 11:33:49 127.0.0.1 - - [19/Nov/2018 11:33:49] "GET / HTTP/1.1" 200 -
2018-11-19 11:33:50 127.0.0.1 - - [19/Nov/2018 11:33:50] "GET /favicon.ico HTTP/1.1" 403 -
我记得之前还好。但自从我重新安装 Docker 后就出现了问题。请帮我解决这个问题。