I once had an electrical outlet with a light switch next to it, in a bathroom. When I replaced the outlet with a GFCI, the light switch quit working.
When you have a GFCI and a light switch is involved, you have to wire things a bit differently so it all works.
Here’s how I fixed it, using a length of wire (use black, or if you only have white wire, put some electrical tape on it) and a wire nut.






