Which sonoff device are you using, and whats the compressor power rating? Also, does the compressor have a power factor (might be printed on the power rating plate that should be attached to it need the power input, or from the manufacturers website)?
If the power consumption is more than the device can handle, it might be tripping some internal protection. If it is a large compressor and has a poor power factor, that can cause havoc with electronic switches; you might have been lucky to get it to work a few times. I assume you have checked the compressor still works when not powered through the device :).
The SonOff Basic.
If i can believe the homedepot website (without looking at my air compressor at home).
we are at 120V 15A roughly 330W
with the specs of the sonoff basic being:
Yep, I’d say over-current is your problem there. I would be inclined to test your Sonoff basics with something much lower powered, to check if you have fried the relays. The basic seems to have a mechanical relay rather than a solid state one, so its possible the contacts inside have melted, or bent out of shape with the high current.
The circuitry inside doesn't appear to have current protection, so if you are handy with a soldering iron, you might be able to replace the relays with a higher capacity version (if you can find one with the same pin-out and dimensions).
You are probably better off getting something that can handle bigger current:
https://www.itead.cc/sonoff-s31.html if you are US based.
Given that’s a big old current draw from your compressor, I’d be inclined to go for the power monitoring versions (i.e. NOT the S31-lite) so you can see exactly what the compressor is doing. The 15A in the spec if probably its max draw, so most of the time it is likely to be less (so within the 15A limit of those switches).
Alternatively, if you can find a power relay for reasonable money, you could have the basic switch another relay that switches the compressor. Probably gonna be expensive and clunky though, as it’ll probably be industrial equipment rather than domestic. I couldn't find a reasonable 120v version, but I didn't look very hard.