I have a Lambda (Go) behind an HTTP API Gateway. Route /webhook is set correctly (payload format 2.0, not $default), but every request to /webhook still triggers my root / handler, im not getting the webhook handler for some reason.
func main() {
mux := http.NewServeMux()
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "hello world")
})
mux.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
})
mux.HandleFunc("/webhook", webhookHandler)
adapter := httpadapter.NewV2(mux)
lambda.Start(adapter.ProxyWithContext)
}
httpadapter.NewV2(), the path from api gateway includes the stage name and reources path structure.