Timeout issue: Your question took too long

I'm getting this error for some queries. However, when I run the same query with an sql client, I don't face this issue. How can I solve this? We have installed metabase on docker using caprover.

Typically this error is caused by a proxy or some other network configuration between Metabase and the database server. This thread is probably a good starting point: How to increase query timeout - Your question took too long