I understand the error is "Bad Gateway" which usually indicates something is wrong with the applications itself but would we refer to Xray to troubleshoot? Any guidance on this? thank you
I think you could use X-Ray to try to get some trace logs from API Gateway…X-Ray supports it. See https://docs.aws.amazon.com/xray/latest/devguide/xray-services-apigateway.html. 504 can be lots of things from a misconfigured REST endpoint to a bad Lambda function to CloudFront just not having time to replicate yet.
Normally, I’ll just break each part of the chain apart and test individually, but X-Ray should help give you some insight.