Error: remaining connection slots are reserved for non-replication superuser connections. sorry, too many clients already

This week my website went down twice because of this error (using postgres on aws - rds)
I had setup the pooling to support max connections of 50. Then I went to check the status and realize that, twice, it went over the 50. Does someone has faced this already?