The problem with the code you posted is, that it should not even compile. The biggest problem being, that there is no Response struct. It probably should be events.APIGatewayProxyResponse.
Furthermore, the code does not return anything, even though you define that it should return Response and error.
I took your code and fixed all of this and it works for me. The fixed code looks like this:
package main
import (
"context"
"fmt"
"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"
)
func HanldeLambdaFunction(ctx context.Context, request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {
limitString := request.QueryStringParameters["limit"]
fmt.Println("limitString", limitString) //nothing is written
return events.APIGatewayProxyResponse{StatusCode: 200}, nil
}
func main() {
lambda.Start(HanldeLambdaFunction)
}
The output is:
START RequestId: 0c63f94f-b0aa-49de-ba6d-b1150d711b8a Version: $LATEST
limitString 2
END RequestId: 0c63f94f-b0aa-49de-ba6d-b1150d711b8a
REPORT RequestId: 0c63f94f-b0aa-49de-ba6d-b1150d711b8a Duration: 0.56 ms Billed Duration: 100 ms Memory Size: 512 MB Max Memory Used: 34 MB
If I had to guess, then your code does not even run. If it would run but could not read the limit parameter, it should at least print limitString.
Remember, if you compile a go binary for AWS Lambda, you need to compile it for linux and amd64 like so:
$ GOOS=linux GOARCH=amd64 go build