Conformal invariance and Ricci-flat spacetimes