Legacy Dev Forum Posts

 View Only

Sign Up

Lambda Data Actions - Example Configuration Request not Validating

  • 1.  Lambda Data Actions - Example Configuration Request not Validating

    Posted 06-05-2025 19:21

    square_eyes | 2020-10-05 20:21:14 UTC | #1

    Following the example here...

    https://help.mypurecloud.com/articles/example-aws-lambda-data-action-with-on-premises-solution/

    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.


    square_eyes | 2020-10-05 20:27:34 UTC | #2

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


    tim.smith | 2020-10-05 20:34:33 UTC | #3

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

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


    square_eyes | 2020-10-05 20:46:02 UTC | #4

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


    square_eyes | 2020-10-05 22:53:47 UTC | #6

    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.


    Jason_Mathison | 2020-10-06 14:35:40 UTC | #7

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

    --Jason


    system | 2020-11-06 14:35:40 UTC | #8

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


    This post was migrated from the old Developer Forum.

    ref: 8974