Hey,

If you have been scratching your head why does API Gateway returns 502 and within your code there are no exceptions ?

Does your API gateway response contain something like below ?

 

Then make sure that you are returning correct response object containing body and status code i.e.

If you still see problem then consider if you are returning complex objects in your body ? If so the following should be additionally applied before returning

And thats it 🙂 Solved the problem for me