Error 504 gateway timeout


We are registering a 504 error on a particular page of our site and when refresh the page or click on the green button on the top left corner it works. We investigated on our AWS infrastructure and there is no way to reproduce the issue. So the issue happens only when we pass through cloudflare. I attached a picture below. Please can you give me more details what this could be related?