I'm new to Golang. I can't seem to supply the argument needed to work with adapter.ProxyWithContext. According to this https://pkg.go.dev/github.com/awslabs/aws-lambda-go-api-proxy@v0.13.0/gorillamux#GorillaMuxAdapter.ProxyWithContext it should accept API Gateway proxy event or API Gateway V2 event.
import (
"context"
"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"
routerProxy "github.com/awslabs/aws-lambda-go-api-proxy/gorillamux"
)
var adapter *routerProxy.GorillaMuxAdapter
func main() {
cfg := config.NewConfig()
s := app.NewApp(cfg, log)
adapter = routerProxy.New(s.SetupRoutes())
lambda.Start(lambdaHandler) // execute lambda and the specific lead handler
}
func lambdaHandler(ctx context.Context, req events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {
c, err := adapter.ProxyWithContext(ctx, req)
return c, err
}
i'm having this error:
``var req events.APIGatewayProxyRequest
cannot use req (variable of type events.APIGatewayProxyRequest) as core.SwitchableAPIGatewayRequest value in argument to adapter.ProxyWithContextcompilerIncompatibleAssign