maintenance... any connector out in the weather need cleaning...
NO Weather Seals.. and the trailer side of the 7 pin has way more issues ..
why do you think many stores sell replacements...
clean contacts with 1000 grit wet/dry sandpaper.. and spray with brake cleaner... and apply a small amount of dielectric grease.
every year.
and check the LID of the 7 pin on the truck.. maybe damaged.. as it is designed to HOLD the trailer connector from moving a lot, or unplugging. but made of plastic and can be damaged.