Reputation: 97
I have a template.yml in which I am trying to define this resource:
HelloFunction:
Type: 'AWS::Serverless::Function'
Properties:
Handler: handler.hello
Runtime: nodejs12.x
InlineCode:
ZipFile: |
exports.handler = async (event) => {
const response = {
statusCode: 200,
body: JSON.stringify('Hello from Lambda function!'),
};
return response;
};
Events:
HelloAPI:
Type: HttpApi
Properties:
ApiId: !Ref SpikeApi
Path: /hello
Method: GET
The resources before this are created without problems, but here I get this error:
Properties validation failed for resource HelloFunction with message: #/Code/ZipFile: expected type: String, found: JSONObject
Upvotes: 2
Views: 12158
Reputation: 5409
there is no need for ZipFile
when using SAM. See the documentation of InlineCode
here: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-function.html#sam-function-inlinecode
Upvotes: 2