I am trying to deploy a lambda function and API gateway . I create a .net core web API project with AWS CLI . Deploying only the function and creating the API gateway and resource manually on aws web console does work.
If I do include the API gateway in the template, after doing SAM package deploying through web console or CLI I get the following error:
"No integration defined for method (Service: AmazonApiGateway; Status Code: 400; Error Code: BadRequestException; Request ID: ....)"
Is anything wrong or missing here?
SAM package command:
sam package --template-file sam-profile.yaml --output-template-file serverless-output.yaml --s3-bucket testapp-fewtfvdy-lambda-deployments SAM Template:
AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Resources: ProfileFunction: Type: AWS::Serverless::Function Properties: Handler: testapp.Profile.NetCoreVS::testapp.Profile.NetCoreVS.LambdaEntryPoint::FunctionHandlerAsync Runtime: dotnetcore2.0 MemorySize : 128 Timeout : 5 CodeUri: bin/Release/netcoreapp2.0/publish Events: ProfileAny: Type: Api Properties: RestApiId: !Ref ProfileApiGateway Path: /profile/v1 Method: GET ProfileApiGateway: DependsOn: ProfileFunction Type: 'AWS::Serverless::Api' Properties: StageName: Prod DefinitionUri: './swagger.yaml' swagger.yaml:
--- swagger: '2.0' info: version: v1 title: ProfileAPI paths: "/profile/v1": get: tags: - Values operationId: ProfileV1Get consumes: [] produces: - text/plain - application/json - text/json parameters: [] responses: '200': description: Success schema: type: array items: type: string definitions: {} .net core method:
[Route("profile/v1")] public class ValuesController : Controller { // GET api/values [HttpGet] public IEnumerable<string> Get() { return new string[] { "value1", "value2","value_new3" }; } }