Lambda Data Actions - Example Configuration Request not Validating

Following the example here...

Configuration Request json fails validation when setting up the Action. I'm copying the json directly from the example.

{
  "requestUrlTemplate": "arn:aws:lambda:{{region}}:{{Lambda ID}}:{{Lambda function}}",
  "requestType": "POST",
  "headers": {},
  "requestTemplate": "{ \"url\": \"${input.url}\", \"method\": \"${input.method}\", \"headers\":${input.headers), \"body\": ${input.body} }"
}

Error...

Template validation failed for 'config.request.requestTemplate'. Details: Encountered "), \"body\": " at validate config.request.requestTemplate[line 1, column 80] Was expecting one of: "[" ... "}" ...

I have played around with different versions of escaping but even if I remove the element in question and put empty {} it still fails validation.

As a side the json above does validate in online linters.

The ) should be } here: \"headers\":${input.headers)

Would you mind submitting feedback on that page that the value is incorrect?

Cool. Have done. Good spot. It validates now.

The example also doesn't give an example of a working request to make from the data action test action.

Do I need to set up an API gateway to get a URL to test? What's an example request body from the example Lambda?

Edit: No it doesn't need an API gateway (IAM with Trust Relationship).
Edit2: For the documentation/example folks, if you're reading this... the Lambda from the example also doesn't work. I had to modify to get it going. It seems to expect a URI variable to be passed in, which isn't in the schema. The example is probably needlessly complex and could just return a hello world and/or parrot back a variable one could test in a callflow somewhere. Also ARN of the Lambda should be marked up/commented/added to the doco to remind the user to update it with their Lambda ARN info. Finally, if the lambda fails it should return a valid response that passes the output schema. As it is currently it hits the fail block and also fails the schema validation for the output.

I created a ticket for our team to go through the documentation around this and address your concerns.

--Jason

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.