I am fairly new to serverless overall, and trying to set up LocalStack on my machine. I have successfully deployed a test lambda function to LocalStack, but currently facing a problem regarding API Gateway.
While deploying with the configuration below, everything works correcty, and i am able to access the lambda function correctly using http, and the resulting endpoint is printed at the end of the deployment as usual:
service: localtest
frameworkVersion: ">=1.74.1"
provider:
name: aws
runtime: nodejs12.x
stage: local
plugins:
- serverless-localstack
custom:
localstack:
stages:
- local
host: http://localhost
autostart: true
endpoints:
S3: http://localhost:4566
DynamoDB: http://localhost:4566
CloudFormation: http://localhost:4566
Elasticsearch: http://localhost:4566
ES: http://localhost:4566
SNS: http://localhost:4566
SQS: http://localhost:4566
Lambda: http://localhost:4566
Kinesis: http://localhost:4566
lambda:
mountCode: True
docker:
sudo: False
functions:
hello:
handler: handler.hello
events:
- http:
method: get
path: /
The resulting output from serverless deploy:
Service Information
service: localtest
stage: local
region: us-east-1
stack: localtest-local
resources: 10
api keys:
None
endpoints:
http://localhost:4567/restapis/720w6afoyh/local/_user_request_
functions:
hello: localtest-local-hello
layers:
None
However, when trying to use the httpApi implementation in the events
- httpApi:
method: get
path: /
i get several errors from localstack, and the function seems to by deployed but does not output a path.
the error log from LocalStack:
2020-07-09T11:39:50:WARNING:moto: No Moto CloudFormation support for AWS::ApiGatewayV2::Integration
2020-07-09T11:39:50:WARNING:moto: No Moto CloudFormation support for AWS::ApiGatewayV2::Stage
2020-07-09T11:39:50:WARNING:moto: No Moto CloudFormation support for AWS::ApiGatewayV2::Api
2020-07-09T11:39:50:WARNING:moto: No Moto CloudFormation support for AWS::ApiGatewayV2::Route
2020-07-09T11:39:50:WARNING:moto: No Moto CloudFormation support for AWS::ApiGatewayV2::Api
2020-07-09T11:39:55:WARNING:localstack.services.cloudformation.cloudformation_starter: Unable to resolve "Ref" attribute for: {'Ref': 'HelloLambdaVersionFjNrIW0CS0DGT44Agi2AjgeDtzxVf8vf0JBR6XRariM'} - HelloLambdaVersionFjNrIW0CS0DGT44Agi2AjgeDtzxVf8vf0JBR6XRariM - <class 'moto.awslambda.models.LambdaVersion'>