Eric is on track, David. Your symptoms (intermittent operation) imply a bad ground or a poorly aligned door trigger switch, or just a loose wire there. Door switches, in the jamb, often have loosened mounting screws due to their being subject to constant door openings and closings and the occasional inadvertent slam.
Seems like when we had similar issues some years back, I accessed the switch or switches’ screws from inside the wheel well, but I’m not sure. If memory serves, which it all too often doesn’t anymore, there is more than one switch in the jamb, for other purposes, and not necessarily all on the wheel well side. Some used a magnet to test the switch operation also I believe. Sorry for the dim memory... others here may clarify.
Joel