I had dockerised my NestJS using MariaDB for database code and was hitting the internal port instead of the external port with my requests. Illustration:
ports:
- "5050:5005" # Bind to IPv4 localhost explicitly
Using 5005 raised the error. Using 5050 worked.