Try cleaning the switch. Put a business card in between the contacts, press together, and pull the card out. Repeat a few times.
If that doesn’t work, make sure the switch is working properly. Is there continuity between the two lugs when the switch is closed? Check with a multimeter.
Next check to make sure there is continuity between the switch lugs and the connectors that go to the back box.