Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to debug a mapping template in aws apigateway

I am trying to create a apigateway mapping template, that transforms this:

{
    "ref": "refs/heads/master"
}

into this:

{
    "download_url":"http://example.com/master"
}

So I tried this:

{
  "branch": $input.path($.ref).substring($input.path($.ref).lastIndexOf('/')+1)
}

Testing this method I get a simple error:

Execution failed due to configuration error: Unable to transform request

Now, of course I would like to know why this failed. But more importantly: How can I debug this? Is there anyway to get a more describing error message for a mapping template?

like image 421
Nathan Avatar asked Oct 17 '25 22:10

Nathan


1 Answers

Not with API Gateway directly, but since API Gateway uses the Velocity template engine under the hood you might consider downloading and running the velocity engine on your own computer to debug your templates.

like image 168
Lorenzo de Lara Avatar answered Oct 20 '25 12:10

Lorenzo de Lara