Internal Server Error when testing AWS API using postman

0

i have been working on a project that takes data from data logger using aws api endpoint and sends to lambda function for parsing and transformation before storing it in mongodb collection the request is successfully handled and data is stored when i am testing via api gateway but whenever i use postman, insomnia and curl i get an internal server error message i have been unable to trace the cause as even my cloud watch shows unable to transform data which is something i cannot understand as i said before it works fine when testing using api gateway and i would like to add that my api has a mapping template as data logger sends payload as form encoded url containing csv data and it is transformed into json by mapping template before being sent to lambda function

  • Did you enable API Gateway execution logs? If so, can you paste the logs so that we can see what is going on?

  • (77eccb24-4f19-4af2-af7d-1a7024850286) Extended Request Id: KUbd3G98hcwFm4w= (77eccb24-4f19-4af2-af7d-1a7024850286) Verifying Usage Plan for request: 77eccb24-4f19-4af2-af7d-1a7024850286. API Key: API Stage: 6lgxld****/Dev (77eccb24-4f19-4af2-af7d-1a7024850286) API Key authorized because method 'POST /' does not require API Key. Request will not contribute to throttle or quota limits (77eccb24-4f19-4af2-af7d-1a7024850286) Usage Plan check succeeded for API Key and API Stage 6lgxld85fh/Dev (77eccb24-4f19-4af2-af7d-1a7024850286) Starting execution for request: 77eccb24-4f19-4af2-af7d-1a7024850286 (77eccb24-4f19-4af2-af7d-1a7024850286) HTTP Method: POST, Resource Path: / (77eccb24-4f19-4af2-af7d-1a7024850286) Request validation succeeded for content type application/x-www-form-urlencoded (77eccb24-4f19-4af2-af7d-1a7024850286) Execution failed due to configuration error: Unable to transform request (77eccb24-4f19-4af2-af7d-1a7024850286) Method completed with status: 500 (77eccb24-4f19-4af2-af7d-1a7024850286) X-ray Tracing ID : Root=1-64eb3f8b-26a4b15b28693ac95af6f9f7

3 Answers
0

Did you enable "Full request and response logs"? If not, make sure you do and in the console Expand all rows to see the full details. Then you can check the different values between the working and non working scenarios..

profile pictureAWS
EXPERT
Uri
answered 8 months ago
  • (4eb969d7-e6a9-432a-9880-202668596506) Extended Request Id: KXy13EWchcwFTdA= (4eb969d7-e6a9-432a-9880-202668596506) Verifying Usage Plan for request: 4eb969d7-e6a9-432a-9880-202668596506. API Key: API Stage: 6lgxld****/Dev (4eb969d7-e6a9-432a-9880-202668596506) API Key authorized because method 'POST /solar' does not require API Key. Request will not contribute to throttle or quota limits (4eb969d7-e6a9-432a-9880-202668596506) Usage Plan check succeeded for API Key and API Stage 6lgxl*****/Dev (4eb969d7-e6a9-432a-9880-202668596506) Starting execution for request: 4eb969d7-e6a9-432a-9880-202668596506 (4eb969d7-e6a9-432a-9880-202668596506) HTTP Method: POST, Resource Path: /s**** (4eb969d7-e6a9-432a-9880-202668596506) Execution failed due to configuration error: Unable to transform request (4eb969d7-e6a9-432a-9880-202668596506) Method completed with status: 500 (4eb969d7-e6a9-432a-9880-202668596506) X-ray Tracing ID : Root=1-64ec9825-24c4aa477273323f02aa957a

  • it really weird from what i gathered is that aws api endpoint is accepting json and form encoded url with the payload and respective content heading from api gateway but only accepts the payload from postman when i use application/json and rejects when i use content header as application/x-www-form-urlencoded i already have added binary support for csv and form-encoded url i know it sounds wrong its a content header not a file but i am kind of new to aws

0

Enter image description here here's the test i am performing for my aws rest api from postman

lambda
answered 8 months ago
0

Enter image description here this is acceptable when i use json header not when i use form encoded url i have no idea what is the reason for this behavior

lambda
answered 8 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions